* read.c (read_a_source_file): When defining a macro in MRI mode,
[deliverable/binutils-gdb.git] / gas / symbols.c
index b1212cbd42cd14ded38ac752a624a769d668ebac..fa2fadbe4b17086835042f4fb82761b5a6d44ebe 100644 (file)
@@ -229,7 +229,7 @@ colon (sym_name)            /* just seen "x:" - rattle symbols & frags */
            {
              symbolP->sy_frag = frag_now;
 #ifdef OBJ_VMS
-             S_GET_OTHER(symbolP) = const_flag;
+             S_SET_OTHER(symbolP, const_flag);
 #endif
              S_SET_VALUE (symbolP, (valueT) frag_now_fix ());
              S_SET_SEGMENT (symbolP, now_seg);
@@ -281,8 +281,8 @@ colon (sym_name)            /* just seen "x:" - rattle symbols & frags */
                         data.  */
                      symbolP->sy_frag = frag_now;
 #ifdef OBJ_VMS
-                     S_GET_OTHER(symbolP) = const_flag;
-#endif /* OBJ_VMS */
+                     S_SET_OTHER(symbolP, const_flag);
+#endif
                      S_SET_VALUE (symbolP, (valueT) frag_now_fix ());
                      S_SET_SEGMENT (symbolP, now_seg); /* keep N_EXT bit */
                    }
@@ -766,13 +766,33 @@ resolve_symbol_value (symp)
          if (seg_left != seg_right
              && seg_left != undefined_section
              && seg_right != undefined_section)
-           as_bad ("%s is operation on symbols in different sections",
-                   S_GET_NAME (symp));
+           {
+             char *file;
+             unsigned int line;
+
+             if (expr_symbol_where (symp, &file, &line))
+               as_bad_where
+                 (file, line,
+                  "illegal operation on symbols in different sections");
+             else
+               as_bad
+                 ("%s set to illegal operation on symbols in different sections",
+                  S_GET_NAME (symp));
+           }
          if ((S_GET_SEGMENT (symp->sy_value.X_add_symbol)
               != absolute_section)
              && symp->sy_value.X_op != O_subtract)
-           as_bad ("%s is illegal operation on non-absolute symbols",
-                   S_GET_NAME (symp));
+           {
+             char *file;
+             unsigned int line;
+
+             if (expr_symbol_where (symp, &file, &line))
+               as_bad_where (file, line,
+                             "illegal operation on non-absolute symbols");
+             else
+               as_bad ("%s set to illegal operation on non-absolute symbols",
+                       S_GET_NAME (symp));
+           }
          left = S_GET_VALUE (symp->sy_value.X_add_symbol);
          right = S_GET_VALUE (symp->sy_value.X_op_symbol);
          switch (symp->sy_value.X_op)
@@ -1358,7 +1378,10 @@ S_SET_EXTERNAL (s)
      symbolS *s;
 {
   if ((s->bsym->flags & BSF_WEAK) != 0)
-    as_warn ("%s already declared as weak", S_GET_NAME (s));
+    {
+      /* Let .weak override .global.  */
+      return;
+    }
   s->bsym->flags |= BSF_GLOBAL;
   s->bsym->flags &= ~(BSF_LOCAL|BSF_WEAK);
 }
@@ -1368,7 +1391,10 @@ S_CLEAR_EXTERNAL (s)
      symbolS *s;
 {
   if ((s->bsym->flags & BSF_WEAK) != 0)
-    as_warn ("%s already declared as weak", S_GET_NAME (s));
+    {
+      /* Let .weak override.  */
+      return;
+    }
   s->bsym->flags |= BSF_LOCAL;
   s->bsym->flags &= ~(BSF_GLOBAL|BSF_WEAK);
 }
@@ -1377,8 +1403,6 @@ void
 S_SET_WEAK (s)
      symbolS *s;
 {
-  if ((s->bsym->flags & BSF_GLOBAL) != 0)
-    as_warn ("%s already declared as global", S_GET_NAME (s));
   s->bsym->flags |= BSF_WEAK;
   s->bsym->flags &= ~(BSF_GLOBAL|BSF_LOCAL);
 }
This page took 0.024734 seconds and 4 git commands to generate.