aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1999-09-12 05:06:09 +0000
committerIan Lance Taylor <ian@airs.com>1999-09-12 05:06:09 +0000
commitc0c949c786c41d6ea03f0c37e0398580044f5c40 (patch)
tree6bf58e48a91cbaf2da324e3e34266f0753a82c44 /gas
parent18dc2407f40dc245a5f0165c5ec6f99dfe1d03ba (diff)
downloadfsf-binutils-gdb-c0c949c786c41d6ea03f0c37e0398580044f5c40.zip
fsf-binutils-gdb-c0c949c786c41d6ea03f0c37e0398580044f5c40.tar.gz
fsf-binutils-gdb-c0c949c786c41d6ea03f0c37e0398580044f5c40.tar.bz2
* config/tc-i386.c (md_apply_fix3): Add horrible adjustments to
the value if TE_PE and a global defined symbol.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog5
-rw-r--r--gas/config/tc-i386.c30
2 files changed, 33 insertions, 2 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 8e114e1..565944d 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,8 @@
+1999-09-12 Ian Lance Taylor <ian@zembu.com>
+
+ * config/tc-i386.c (md_apply_fix3): Add horrible adjustments to
+ the value if TE_PE and a global defined symbol.
+
1999-09-11 Ian Lance Taylor <ian@zembu.com>
* write.c (dump_section_relocs): Call print_symbol_value_1 to
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 0a6b1de..8e3cae7 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -938,8 +938,8 @@ reloc (size, pcrel, other)
* some cases we force the original symbol to be used.
*/
int
-tc_i386_fix_adjustable(fixP)
- fixS * fixP;
+tc_i386_fix_adjustable (fixP)
+ fixS *fixP;
{
#if defined (OBJ_ELF) || defined (TE_PE)
/* Prevent all adjustments to global symbols, or else dynamic
@@ -3908,8 +3908,34 @@ md_apply_fix3 (fixP, valp, seg)
address offset for a PC relative symbol. */
if (S_GET_SEGMENT (fixP->fx_addsy) != seg)
value += md_pcrel_from (fixP);
+ else if (S_IS_EXTERNAL (fixP->fx_addsy)
+ || S_IS_WEAK (fixP->fx_addsy))
+ {
+ /* We are generating an external relocation for this defined
+ symbol. We add the address, because
+ bfd_install_relocation will subtract it. VALUE already
+ holds the symbol value, because fixup_segment added it
+ in. We subtract it out, and then we subtract it out
+ again because bfd_install_relocation will add it in
+ again. */
+ value += md_pcrel_from (fixP);
+ value -= 2 * S_GET_VALUE (fixP->fx_addsy);
+ }
#endif
}
+#ifdef TE_PE
+ else if (fixP->fx_addsy != NULL
+ && S_IS_DEFINED (fixP->fx_addsy)
+ && (S_IS_EXTERNAL (fixP->fx_addsy)
+ || S_IS_WEAK (fixP->fx_addsy)))
+ {
+ /* We are generating an external relocation for this defined
+ symbol. VALUE already holds the symbol value, and
+ bfd_install_relocation will add it in again. We don't want
+ either addition. */
+ value -= 2 * S_GET_VALUE (fixP->fx_addsy);
+ }
+#endif
/* Fix a few things - the dynamic linker expects certain values here,
and we must not dissappoint it. */