summaryrefslogtreecommitdiff
path: root/gas/write.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2008-09-19 10:00:40 +0000
committerAlan Modra <amodra@bigpond.net.au>2008-09-19 10:00:40 +0000
commit91b5071e42c909b5973f0ebd4df7184ae4994e73 (patch)
tree9a4ef6bffd9eb0bef27b95bbfa5c6d8d1afd2fc4 /gas/write.c
parent26913ce4e3ff4c80828a6809114d133caa0de814 (diff)
downloadbinutils-redhat-91b5071e42c909b5973f0ebd4df7184ae4994e73.tar.gz
* write.c (TC_FORCE_RELOCATION_SUB_LOCAL): Heed md_register_arithmetic.
(TC_VALIDATE_FIX_SUB): Likewise. * config/tc-frv.h (TC_FORCE_RELOCATION_SUB_LOCAL): Likewise. * config/tc-hppa.h (TC_FORCE_RELOCATION_SUB_LOCAL): Likewise. * config/tc-mn10300.h (TC_VALIDATE_FIX_SUB): Likewise. * config/tc-sh.h (TC_VALIDATE_FIX_SUB): Likewise. (TC_FORCE_RELOCATION_SUB_LOCAL): Likewise. * config/tc-sh64.h (TC_VALIDATE_FIX_SUB): Likewise. * config/tc-xtensa.h (TC_VALIDATE_FIX_SUB): Likewise. * doc/internals.texi (TC_FORCE_RELOCATION_SUB_ABS, TC_FORCE_RELOCATION_SUB_LOCAL, TC_VALIDATE_FIX_SUB): Show new param.
Diffstat (limited to 'gas/write.c')
-rw-r--r--gas/write.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/gas/write.c b/gas/write.c
index f03fcf3d5b..1af81a7df9 100644
--- a/gas/write.c
+++ b/gas/write.c
@@ -65,20 +65,23 @@
#ifndef TC_FORCE_RELOCATION_SUB_LOCAL
#ifdef DIFF_EXPR_OK
-#define TC_FORCE_RELOCATION_SUB_LOCAL(FIX) 0
+#define TC_FORCE_RELOCATION_SUB_LOCAL(FIX, SEG) \
+ (!md_register_arithmetic && (SEG) == reg_section)
#else
-#define TC_FORCE_RELOCATION_SUB_LOCAL(FIX) 1
+#define TC_FORCE_RELOCATION_SUB_LOCAL(FIX, SEG) 1
#endif
#endif
#ifndef TC_VALIDATE_FIX_SUB
#ifdef UNDEFINED_DIFFERENCE_OK
/* The PA needs this for PIC code generation. */
-#define TC_VALIDATE_FIX_SUB(FIX) 1
+#define TC_VALIDATE_FIX_SUB(FIX, SEG) \
+ (md_register_arithmetic || (SEG) != reg_section)
#else
-#define TC_VALIDATE_FIX_SUB(FIX) \
- ((FIX)->fx_r_type == BFD_RELOC_GPREL32 \
- || (FIX)->fx_r_type == BFD_RELOC_GPREL16)
+#define TC_VALIDATE_FIX_SUB(FIX, SEG) \
+ ((md_register_arithmetic || (SEG) != reg_section) \
+ && ((FIX)->fx_r_type == BFD_RELOC_GPREL32 \
+ || (FIX)->fx_r_type == BFD_RELOC_GPREL16))
#endif
#endif
@@ -936,7 +939,7 @@ fixup_segment (fixS *fixP, segT this_segment)
fixP->fx_subsy = NULL;
}
else if (sub_symbol_segment == this_segment
- && !TC_FORCE_RELOCATION_SUB_LOCAL (fixP))
+ && !TC_FORCE_RELOCATION_SUB_LOCAL (fixP, add_symbol_segment))
{
add_number -= S_GET_VALUE (fixP->fx_subsy);
fixP->fx_offset = (add_number + fixP->fx_dot_value
@@ -958,7 +961,7 @@ fixup_segment (fixS *fixP, segT this_segment)
fixP->fx_subsy = NULL;
fixP->fx_pcrel = 1;
}
- else if (!TC_VALIDATE_FIX_SUB (fixP))
+ else if (!TC_VALIDATE_FIX_SUB (fixP, add_symbol_segment))
{
if (!md_register_arithmetic
&& (add_symbol_segment == reg_section