* write.c (md_register_arithmetic): Define.
authorAlan Modra <amodra@gmail.com>
Fri, 19 Sep 2008 02:11:02 +0000 (02:11 +0000)
committerAlan Modra <amodra@gmail.com>
Fri, 19 Sep 2008 02:11:02 +0000 (02:11 +0000)
(fixup_segment): Adjust TC_FORCE_RELOCATION_SUB_ABS invocation.
Modify error message when registers involved.
(TC_FORCE_RELOCATION_SUB_ABS): Heed md_register_arithmetic.
* config/tc-sh.h (TC_FORCE_RELOCATION_SUB_ABS): Likewise.

gas/ChangeLog
gas/config/tc-sh.h
gas/write.c

index 8490ad8d770ba0fa86bd22f78c89c509ef3897da..7b22d2fe32b3d8fb6d748e49903217888d3d5568 100644 (file)
@@ -1,3 +1,11 @@
+2008-09-19  Alan Modra  <amodra@bigpond.net.au>
+
+       * write.c (md_register_arithmetic): Define.
+       (fixup_segment): Adjust TC_FORCE_RELOCATION_SUB_ABS invocation.
+       Modify error message when registers involved.
+       (TC_FORCE_RELOCATION_SUB_ABS): Heed md_register_arithmetic.
+       * config/tc-sh.h (TC_FORCE_RELOCATION_SUB_ABS): Likewise.
+
 2008-09-15  Alan Modra  <amodra@bigpond.net.au>
 
        * write.c (install_reloc): Correct EMIT_SECTION_SYMBOLS test.
index dfdabd479c67675776a3b68539af883dc0dd15dd..a3187b3d0a4b09d2731eeee02076942980531e20 100644 (file)
@@ -211,8 +211,9 @@ extern bfd_boolean sh_fix_adjustable (struct fix *);
 
 /* This keeps the subtracted symbol around, for use by PLT_PCREL
    relocs.  */
-#define TC_FORCE_RELOCATION_SUB_ABS(FIX)               \
-  ((FIX)->fx_r_type == BFD_RELOC_32_PLT_PCREL)
+#define TC_FORCE_RELOCATION_SUB_ABS(FIX, SEG)          \
+  ((FIX)->fx_r_type == BFD_RELOC_32_PLT_PCREL          \
+   || (!md_register_arithmetic && (SEG) == reg_section))
 
 /* Don't complain when we leave fx_subsy around.  */
 #undef TC_VALIDATE_FIX_SUB
index f164e2eeab06e590972eeba811adbb748a3a96e4..f03fcf3d5b33968957477579108f68f8619b51aa 100644 (file)
   (! SEG_NORMAL (SEG))
 #endif
 
+#ifndef md_register_arithmetic
+# define md_register_arithmetic 1
+#endif
+
 #ifndef TC_FORCE_RELOCATION_SUB_ABS
-#define TC_FORCE_RELOCATION_SUB_ABS(FIX)       0
+#define TC_FORCE_RELOCATION_SUB_ABS(FIX, SEG)  \
+  (!md_register_arithmetic && (SEG) == reg_section)
 #endif
 
 #ifndef TC_FORCE_RELOCATION_SUB_LOCAL
@@ -924,7 +929,7 @@ fixup_segment (fixS *fixP, segT this_segment)
 #endif
            }
          else if (sub_symbol_segment == absolute_section
-                  && !TC_FORCE_RELOCATION_SUB_ABS (fixP))
+                  && !TC_FORCE_RELOCATION_SUB_ABS (fixP, add_symbol_segment))
            {
              add_number -= S_GET_VALUE (fixP->fx_subsy);
              fixP->fx_offset = add_number;
@@ -955,12 +960,18 @@ fixup_segment (fixS *fixP, segT this_segment)
            }
          else if (!TC_VALIDATE_FIX_SUB (fixP))
            {
-             as_bad_where (fixP->fx_file, fixP->fx_line,
-                           _("can't resolve `%s' {%s section} - `%s' {%s section}"),
-                           fixP->fx_addsy ? S_GET_NAME (fixP->fx_addsy) : "0",
-                           segment_name (add_symbol_segment),
-                           S_GET_NAME (fixP->fx_subsy),
-                           segment_name (sub_symbol_segment));
+             if (!md_register_arithmetic
+                 && (add_symbol_segment == reg_section
+                     || sub_symbol_segment == reg_section))
+               as_bad_where (fixP->fx_file, fixP->fx_line,
+                             _("register value used as expression"));
+             else
+               as_bad_where (fixP->fx_file, fixP->fx_line,
+                             _("can't resolve `%s' {%s section} - `%s' {%s section}"),
+                             fixP->fx_addsy ? S_GET_NAME (fixP->fx_addsy) : "0",
+                             segment_name (add_symbol_segment),
+                             S_GET_NAME (fixP->fx_subsy),
+                             segment_name (sub_symbol_segment));
            }
        }
 
This page took 0.028136 seconds and 4 git commands to generate.