diff options
author | Nick Clifton <nickc@redhat.com> | 2007-05-03 15:55:38 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2007-05-03 15:55:38 +0000 |
commit | 22184a77bedbe9a50b48f0bc50ff1f8898699a39 (patch) | |
tree | 1a563035196ee0761363a56faf64d41131a243b5 /gas | |
parent | fe7929ce4ac0d763d5669ada789c0b93140ce922 (diff) | |
download | gdb-22184a77bedbe9a50b48f0bc50ff1f8898699a39.zip gdb-22184a77bedbe9a50b48f0bc50ff1f8898699a39.tar.gz gdb-22184a77bedbe9a50b48f0bc50ff1f8898699a39.tar.bz2 |
PR gas/3041
* gas/config/tc-m68k.c (relaxable_symbol): Do not relax weak symbols.
(tc_gen_reloc): Adjust the addend of relocs against weak symbols.
(md_apply_fix): Put zero values into the frags referencing weak symbols.
* bfd/aoutx.h (swap_std_reloc_out): Treat relocs against weak symbols in the same way as relocs against external symbols.
Diffstat (limited to 'gas')
-rw-r--r-- | gas/ChangeLog | 9 | ||||
-rw-r--r-- | gas/config/tc-m68k.c | 20 |
2 files changed, 27 insertions, 2 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index f0a4faa..3a38e5e 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,12 @@ +2007-05-03 Vincent Riviere <vincent.riviere@freesbee.fr> + Nick Clifton <nickc@redhat.com> + + PR gas/3041 + * config/tc-m68k.c (relaxable_symbol): Do not relax weak symbols. + (tc_gen_reloc): Adjust the addend of relocs against weak symbols. + (md_apply_fix): Put zero values into the frags referencing weak + symbols. + 2007-05-02 Alan Modra <amodra@bigpond.net.au> PR 4448 diff --git a/gas/config/tc-m68k.c b/gas/config/tc-m68k.c index fedbafc..dd95139 100644 --- a/gas/config/tc-m68k.c +++ b/gas/config/tc-m68k.c @@ -1,6 +1,6 @@ /* tc-m68k.c -- Assemble for the m68k family Copyright 1987, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. + 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -1059,7 +1059,9 @@ tc_m68k_fix_adjustable (fixS *fixP) #define get_reloc_code(SIZE,PCREL,OTHER) NO_RELOC -#define relaxable_symbol(symbol) 1 +/* PR gas/3041 Weak symbols are not relaxable + because they must be treated as extern. */ +#define relaxable_symbol(symbol) (!(S_IS_WEAK (symbol))) #endif /* OBJ_ELF */ @@ -1153,6 +1155,13 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixp) #ifndef OBJ_ELF if (fixp->fx_pcrel) reloc->addend = fixp->fx_addnumber; + else if (OUTPUT_FLAVOR == bfd_target_aout_flavour + && fixp->fx_addsy + && S_IS_WEAK (fixp->fx_addsy) + && ! bfd_is_und_section (S_GET_SEGMENT (fixp->fx_addsy))) + /* PR gas/3041 Adjust addend in order to force bfd_install_relocation() + to put a zero value into frags referencing a weak symbol. */ + reloc->addend = - S_GET_VALUE (fixp->fx_addsy); else reloc->addend = 0; #else @@ -4692,6 +4701,13 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) S_SET_WEAK (fixP->fx_addsy); return; } +#elif defined(OBJ_AOUT) + /* PR gas/3041 Always put zero values into frags referencing a weak symbol. */ + if (fixP->fx_addsy && S_IS_WEAK (fixP->fx_addsy)) + { + memset (buf, 0, fixP->fx_size); + return; + } #endif if (fixP->fx_r_type == BFD_RELOC_VTABLE_INHERIT |