aboutsummaryrefslogtreecommitdiff
path: root/gas/config
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1997-02-03 17:56:00 +0000
committerIan Lance Taylor <ian@airs.com>1997-02-03 17:56:00 +0000
commit1748b9d8f026c5de3119dafef4ecbdef19016512 (patch)
tree2a7674d61c46b8edf0c168e0da9dd1ac75cf11e1 /gas/config
parent3569064fb5f1bce22b31a3c9d425e7fffdd214c7 (diff)
downloadbinutils-1748b9d8f026c5de3119dafef4ecbdef19016512.zip
binutils-1748b9d8f026c5de3119dafef4ecbdef19016512.tar.gz
binutils-1748b9d8f026c5de3119dafef4ecbdef19016512.tar.bz2
* config/tc-mips.c (md_apply_fix): If we aren't adjusting this
fixup to be against the section symbol, adjust the value accordingly.
Diffstat (limited to 'gas/config')
-rw-r--r--gas/config/tc-mips.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c
index 4a59ab9..52f8c0b 100644
--- a/gas/config/tc-mips.c
+++ b/gas/config/tc-mips.c
@@ -8217,6 +8217,27 @@ md_apply_fix (fixP, valueP)
|| fixP->fx_r_type == BFD_RELOC_64);
value = *valueP;
+
+ /* If we aren't adjusting this fixup to be against the section
+ symbol, we need to adjust the value. */
+#ifdef S_GET_OTHER
+ if (fixP->fx_addsy != NULL
+ && (S_IS_EXTERNAL (fixP->fx_addsy)
+ || S_IS_WEAK (fixP->fx_addsy))
+ && OUTPUT_FLAVOR == bfd_target_elf_flavour
+ && S_GET_OTHER (fixP->fx_addsy) == STO_MIPS16)
+ {
+ value -= S_GET_VALUE (fixP->fx_addsy);
+ if (value != 0 && ! fixP->fx_pcrel)
+ {
+ /* In this case, the bfd_install_relocation routine will
+ incorrectly add the symbol value back in. We just want
+ the addend to appear in the object file. */
+ value -= S_GET_VALUE (fixP->fx_addsy);
+ }
+ }
+#endif
+
fixP->fx_addnumber = value; /* Remember value for tc_gen_reloc */
if (fixP->fx_addsy == NULL && ! fixP->fx_pcrel)