* symbols.c (resolve_symbol_value <O_uminus, O_bit_not,
authorAlan Modra <amodra@gmail.com>
Wed, 3 Apr 2002 04:10:28 +0000 (04:10 +0000)
committerAlan Modra <amodra@gmail.com>
Wed, 3 Apr 2002 04:10:28 +0000 (04:10 +0000)
O_logical_not>): Derive final_seg from add_symbol.
<O_multiply..O_logical_or>: More final_seg twiddles.

gas/ChangeLog
gas/symbols.c

index 15d070e963e967fb7bc51b46db1edc6b90026132..fa2cfb085a754f31efd7a180eafc91cb06cfaaa2 100644 (file)
@@ -1,3 +1,9 @@
+2002-04-03  Alan Modra  <amodra@bigpond.net.au>
+
+       * symbols.c (resolve_symbol_value <O_uminus, O_bit_not,
+       O_logical_not>): Derive final_seg from add_symbol.
+       <O_multiply..O_logical_or>: More final_seg twiddles.
+
 2002-04-01  Jessica Han  <jessica@cup.hp.com>
 
         * config/tc-ia64.c (ia64_cons_fix_new): Handle 8 byte iplt reloc
index 5dd304091bddb2eb7a1ef45f9e5026304a8dbbdb..5a55fcaf9ff38471eb8de1cee671457c95733b9b 100644 (file)
@@ -986,6 +986,7 @@ resolve_symbol_value (symp)
        case O_bit_not:
        case O_logical_not:
          left = resolve_symbol_value (add_symbol);
+         seg_left = S_GET_SEGMENT (add_symbol);
 
          if (op == O_uminus)
            left = -left;
@@ -996,7 +997,7 @@ resolve_symbol_value (symp)
 
          final_val += left + symp->sy_frag->fr_address;
          if (final_seg == expr_section || final_seg == undefined_section)
-           final_seg = absolute_section;
+           final_seg = seg_left;
 
          resolved = symbol_resolved_p (add_symbol);
          break;
@@ -1062,15 +1063,19 @@ resolve_symbol_value (symp)
 
             Don't emit messages unless we're finalizing the symbol value,
             otherwise we may get the same message multiple times.  */
-         if (op != O_eq && op != O_ne
-             && (seg_left != absolute_section
-                 || seg_right != absolute_section)
-             && ((op != O_subtract
-                  && op != O_lt && op != O_le && op != O_ge && op != O_gt)
-                 || seg_left != seg_right
-                 || (seg_left == undefined_section
-                     && add_symbol != op_symbol))
-             && finalize_syms)
+         if ((op == O_eq || op == O_ne)
+             || ((op == O_subtract
+                  || op == O_lt || op == O_le || op == O_ge || op == O_gt)
+                 && seg_left == seg_right
+                 && (seg_left != undefined_section
+                     || add_symbol == op_symbol))
+             || (seg_left == absolute_section
+                 && seg_right == absolute_section))
+           {
+             if (final_seg == expr_section || final_seg == undefined_section)
+               final_seg = absolute_section;
+           }
+         else if (finalize_syms)
            {
              char *file;
              unsigned int line;
@@ -1105,6 +1110,9 @@ resolve_symbol_value (symp)
                    as_bad (_("invalid section for operation setting `%s'"),
                            S_GET_NAME (symp));
                }
+             /* Prevent the error propagating.  */
+             if (final_seg == expr_section || final_seg == undefined_section)
+               final_seg = absolute_section;
            }
 
          /* Check for division by zero.  */
@@ -1160,7 +1168,15 @@ resolve_symbol_value (symp)
 
          final_val += symp->sy_frag->fr_address + left;
          if (final_seg == expr_section || final_seg == undefined_section)
-           final_seg = absolute_section;
+           {
+             if (seg_left == undefined_section
+                 || seg_right == undefined_section)
+               final_seg = undefined_section;
+             else if (seg_left == absolute_section)
+               final_seg = seg_right;
+             else
+               final_seg = seg_left;
+           }
          resolved = (symbol_resolved_p (add_symbol)
                      && symbol_resolved_p (op_symbol));
          break;