2001-06-24 Fernando Nasser <fnasser@redhat.com>
[deliverable/binutils-gdb.git] / gas / symbols.c
index 36407238aaccd0a22391a9876daf409b242c7da1..8396dabdeed5422167827ecd0eb9f5a53f270f70 100644 (file)
@@ -942,13 +942,14 @@ resolve_symbol_value (symp)
            {
              if (finalize_syms)
                {
-                 S_SET_SEGMENT (symp, S_GET_SEGMENT (add_symbol));
+                 final_seg = S_GET_SEGMENT (add_symbol);
                  symp->sy_value.X_op = O_symbol;
                  symp->sy_value.X_add_symbol = add_symbol;
                  symp->sy_value.X_add_number = final_val;
                }
              final_val = 0;
              resolved = symbol_resolved_p (add_symbol);
+             symp->sy_resolving = 0;
              goto exit_dont_set_value;
            }
          else
@@ -1145,18 +1146,18 @@ resolve_symbol_value (symp)
     }
 
   if (finalize_syms)
-    {
-      S_SET_VALUE (symp, final_val);
+    S_SET_VALUE (symp, final_val);
 
+exit_dont_set_value:
+  /* Always set the segment, even if not finalizing the value.
+     The segment is used to determine whether a symbol is defined.  */
 #if defined (OBJ_AOUT) && ! defined (BFD_ASSEMBLER)
-      /* The old a.out backend does not handle S_SET_SEGMENT correctly
-         for a stab symbol, so we use this bad hack.  */
-      if (final_seg != S_GET_SEGMENT (symp))
+  /* The old a.out backend does not handle S_SET_SEGMENT correctly
+     for a stab symbol, so we use this bad hack.  */
+  if (final_seg != S_GET_SEGMENT (symp))
 #endif
-       S_SET_SEGMENT (symp, final_seg);
-    }
+    S_SET_SEGMENT (symp, final_seg);
 
-exit_dont_set_value:
   /* Don't worry if we can't resolve an expr_section symbol.  */
   if (finalize_syms)
     {
@@ -1823,6 +1824,17 @@ S_SET_EXTERNAL (s)
       /* Let .weak override .global.  */
       return;
     }
+  if (s->bsym->flags & BSF_SECTION_SYM)
+    {
+      char * file;
+      unsigned int line;
+      
+      /* Do not reassign section symbols.  */
+      as_where (& file, & line);
+      as_warn_where (file, line,
+                    _("Section symbols are already global"));
+      return;
+    }
   s->bsym->flags |= BSF_GLOBAL;
   s->bsym->flags &= ~(BSF_LOCAL | BSF_WEAK);
 }
This page took 0.023423 seconds and 4 git commands to generate.