2006-05-02 H.J. Lu <hongjiu.lu@intel.com>
[deliverable/binutils-gdb.git] / gas / symbols.c
index f6dafcd86b239ea4471486ec6e8325c0bfe65152..499e8c4d31b3bf43d517034758f70a18de2c9367 100644 (file)
@@ -336,10 +336,7 @@ colon (/* Just seen "x:" - rattle symbols & frags.  */
               || S_IS_COMMON (symbolP)
               || S_IS_VOLATILE (symbolP))
        {
-         if (S_IS_VOLATILE (symbolP)
-             /* This could be avoided when the symbol wasn't used so far, but
-                the comment in struc-symbol.h says this flag isn't reliable.  */
-             && (1 || !symbol_used_p (symbolP)))
+         if (S_IS_VOLATILE (symbolP))
            {
              symbolP = symbol_clone (symbolP, 1);
              S_SET_VALUE (symbolP, 0);
@@ -376,6 +373,7 @@ colon (/* Just seen "x:" - rattle symbols & frags.  */
                    && S_IS_EXTERNAL (symbolP))
                   || S_GET_SEGMENT (symbolP) == bss_section)
                  && (now_seg == data_section
+                     || now_seg == bss_section
                      || now_seg == S_GET_SEGMENT (symbolP)))
                {
                  /* Select which of the 2 cases this is.  */
@@ -1354,8 +1352,10 @@ resolve_local_symbol_values (void)
    sub-expressions used.  */
 
 int
-snapshot_symbol (symbolS *symbolP, valueT *valueP, segT *segP, fragS **fragPP)
+snapshot_symbol (symbolS **symbolPP, valueT *valueP, segT *segP, fragS **fragPP)
 {
+  symbolS *symbolP = *symbolPP;
+
   if (LOCAL_SYMBOL_CHECK (symbolP))
     {
       struct local_symbol *locsym = (struct local_symbol *) symbolP;
@@ -1384,10 +1384,7 @@ snapshot_symbol (symbolS *symbolP, valueT *valueP, segT *segP, fragS **fragPP)
            {
            case O_constant:
            case O_register:
-             /* This check wouldn't be needed if pseudo_set() didn't set
-                symbols equated to bare symbols to undefined_section.  */
-             if (symbolP->bsym->section != undefined_section
-                 || symbolP->sy_value.X_op != O_symbol)
+             if (!symbol_equated_p (symbolP))
                break;
              /* Fall thru.  */
            case O_symbol:
@@ -1399,6 +1396,10 @@ snapshot_symbol (symbolS *symbolP, valueT *valueP, segT *segP, fragS **fragPP)
            }
        }
 
+      /* Never change a defined symbol.  */
+      if (symbolP->bsym->section == undefined_section
+         || symbolP->bsym->section == expr_section)
+       *symbolPP = symbolP;
       *valueP = expr.X_add_number;
       *segP = symbolP->bsym->section;
       *fragPP = symbolP->sy_frag;
This page took 0.025868 seconds and 4 git commands to generate.