* symbols.c (symbol_clone_if_forward_ref): Don't limit cloning
authorMaciej W. Rozycki <macro@linux-mips.org>
Wed, 1 Dec 2010 20:35:13 +0000 (20:35 +0000)
committerMaciej W. Rozycki <macro@linux-mips.org>
Wed, 1 Dec 2010 20:35:13 +0000 (20:35 +0000)
to expr_section symbols; clone all equated symbols.  Clear
sy_resolving of the cloned copy.
* expr.c (operand): Only clone equated symbols on a final
(i.e. non-equated) reference.

gas/ChangeLog
gas/expr.c
gas/symbols.c

index e02bc3a2f39dff937a6f7d859a545b7b43ae8004..374c60e3a337b70a5a7e84fabe4a646aba58c4c1 100644 (file)
@@ -1,3 +1,11 @@
+2010-12-01  Maciej W. Rozycki  <macro@codesourcery.com>
+
+       * symbols.c (symbol_clone_if_forward_ref): Don't limit cloning
+       to expr_section symbols; clone all equated symbols.  Clear
+       sy_resolving of the cloned copy.
+       * expr.c (operand): Only clone equated symbols on a final
+       (i.e. non-equated) reference.
+
 2010-12-01  Richard Sandiford  <rdsandiford@googlemail.com>
 
        * config/tc-mips.c (md_convert_frag): Remove a call to
index f050b17ccb2123e68c305570a1ea0575a2363820..620fdce31d76c0ed9334f5c4608d9747fa1eca2a 100644 (file)
@@ -1373,8 +1373,13 @@ operand (expressionS *expressionP, enum expr_mode mode)
   if (expressionP->X_add_symbol)
     symbol_mark_used (expressionP->X_add_symbol);
 
-  expressionP->X_add_symbol = symbol_clone_if_forward_ref (expressionP->X_add_symbol);
-  expressionP->X_op_symbol = symbol_clone_if_forward_ref (expressionP->X_op_symbol);
+  if (mode != expr_defer)
+    {
+      expressionP->X_add_symbol
+       = symbol_clone_if_forward_ref (expressionP->X_add_symbol);
+      expressionP->X_op_symbol
+       = symbol_clone_if_forward_ref (expressionP->X_op_symbol);
+    }
 
   switch (expressionP->X_op)
     {
index 7b5e514a315f9805e00a556db7d30a5d49ba1162..e432b8603f689323645dfab5ecf3be2cedf97c01 100644 (file)
@@ -645,7 +645,8 @@ symbol_clone_if_forward_ref (symbolS *symbolP, int is_forward)
 
       /* Re-using sy_resolving here, as this routine cannot get called from
         symbol resolution code.  */
-      if (symbolP->bsym->section == expr_section && !symbolP->sy_resolving)
+      if ((symbolP->bsym->section == expr_section || symbolP->sy_forward_ref)
+         && !symbolP->sy_resolving)
        {
          symbolP->sy_resolving = 1;
          add_symbol = symbol_clone_if_forward_ref (add_symbol, is_forward);
@@ -656,7 +657,10 @@ symbol_clone_if_forward_ref (symbolS *symbolP, int is_forward)
       if (symbolP->sy_forward_ref
          || add_symbol != symbolP->sy_value.X_add_symbol
          || op_symbol != symbolP->sy_value.X_op_symbol)
-       symbolP = symbol_clone (symbolP, 0);
+       {
+         symbolP = symbol_clone (symbolP, 0);
+         symbolP->sy_resolving = 0;
+       }
 
       symbolP->sy_value.X_add_symbol = add_symbol;
       symbolP->sy_value.X_op_symbol = op_symbol;