From b25a253ca8d997616d22ad33c212ed478a8c7dc7 Mon Sep 17 00:00:00 2001 From: Chris Demetriou Date: Tue, 26 Feb 2002 22:18:51 +0000 Subject: 2002-02-26 Chris Demetriou * config/tc-mips.c (mips_need_elf_addend_fixup): For embedded-PIC only, undo the changes made on 2001-06-08, with the effect being that common or extern symbols are adjusted for embedded-PIC, but weak symbols are not. (md_estimate_size_before_relax: Likewise, with the effect that extern symbols are treated the same as weak symbols only if not embedded-PIC. (mips_fix_adjustable) Likewise, with the effect that weak or extern symbols are not adjusted for embedded-PIC. (md_apply_fix3): Tweak so that the case where value is zero is handled more correctly for embedded-PIC code. --- gas/ChangeLog | 14 ++++++++++++++ gas/config/tc-mips.c | 17 +++++++++++++---- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 1f5abf7..19b5dee 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,17 @@ +2002-02-26 Chris Demetriou + + * config/tc-mips.c (mips_need_elf_addend_fixup): For embedded-PIC + only, undo the changes made on 2001-06-08, with the + effect being that common or extern symbols are + adjusted for embedded-PIC, but weak symbols are not. + (md_estimate_size_before_relax: Likewise, with the effect + that extern symbols are treated the same as weak symbols + only if not embedded-PIC. + (mips_fix_adjustable) Likewise, with the effect that + weak or extern symbols are not adjusted for embedded-PIC. + (md_apply_fix3): Tweak so that the case where value is zero + is handled more correctly for embedded-PIC code. + 2002-02-26 Nick Clifton * doc/as.texinfo (Overview): Add missing @ifset IA64 diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c index 048d445..b3acb5c 100644 --- a/gas/config/tc-mips.c +++ b/gas/config/tc-mips.c @@ -10419,8 +10419,12 @@ mips_need_elf_addend_fixup (fixP) { if (S_GET_OTHER (fixP->fx_addsy) == STO_MIPS16) return 1; - if ((S_IS_WEAK (fixP->fx_addsy) - || S_IS_EXTERN (fixP->fx_addsy)) + if (mips_pic == EMBEDDED_PIC + && S_IS_WEAK (fixP->fx_addsy)) + return 1; + if (mips_pic != EMBEDDED_PIC + && (S_IS_WEAK (fixP->fx_addsy) + || S_IS_EXTERN (fixP->fx_addsy)) && !S_IS_COMMON (fixP->fx_addsy)) return 1; if (symbol_used_in_reloc_p (fixP->fx_addsy) @@ -10714,7 +10718,10 @@ md_apply_fix3 (fixP, valP, seg) /* If 'value' is zero, the remaining reloc code won't actually do the store, so it must be done here. This is probably a bug somewhere. */ - if (!fixP->fx_done) + if (!fixP->fx_done + && (fixP->fx_r_type != BFD_RELOC_16_PCREL_S2 + || fixP->fx_addsy == NULL /* ??? */ + || ! S_IS_DEFINED (fixP->fx_addsy))) value -= fixP->fx_frag->fr_address + fixP->fx_where; value = (offsetT) value >> 2; @@ -12208,7 +12215,8 @@ md_estimate_size_before_relax (fragp, segtype) #ifdef OBJ_ELF /* A global or weak symbol is treated as external. */ && (OUTPUT_FLAVOR != bfd_target_elf_flavour - || (! S_IS_EXTERN (sym) && ! S_IS_WEAK (sym))) + || (! S_IS_WEAK (sym) + && (! S_IS_EXTERN (sym) || mips_pic == EMBEDDED_PIC))) #endif ); } @@ -12249,6 +12257,7 @@ mips_fix_adjustable (fixp) #ifdef OBJ_ELF /* Prevent all adjustments to global symbols. */ if (OUTPUT_FLAVOR == bfd_target_elf_flavour + && mips_pic != EMBEDDED_PIC && (S_IS_EXTERN (fixp->fx_addsy) || S_IS_WEAK (fixp->fx_addsy))) return 0; #endif -- cgit v1.1