aboutsummaryrefslogtreecommitdiff
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
parent3569064fb5f1bce22b31a3c9d425e7fffdd214c7 (diff)
downloadgdb-1748b9d8f026c5de3119dafef4ecbdef19016512.zip
gdb-1748b9d8f026c5de3119dafef4ecbdef19016512.tar.gz
gdb-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.
-rw-r--r--gas/ChangeLog4
-rw-r--r--gas/config/tc-mips.c21
2 files changed, 25 insertions, 0 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 51d9df0..a861a8f 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,5 +1,9 @@
Mon Feb 3 12:35:54 1997 Ian Lance Taylor <ian@cygnus.com>
+ * config/tc-mips.c (md_apply_fix): If we aren't adjusting this
+ fixup to be against the section symbol, adjust the value
+ accordingly.
+
* symbols.c (resolve_symbol_value): Don't change X_add_number for
an equated symbol.
* write.c (write_relocs): Avoid looping on equated symbols.
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)