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.
This commit is contained in:
Nick Clifton 2007-05-03 15:55:38 +00:00
parent fe7929ce4a
commit 22184a77be
4 changed files with 38 additions and 3 deletions

View File

@ -1,3 +1,10 @@
2007-05-03 Vincent Riviere <vincent.riviere@freesbee.fr>
Nick Clifton <nickc@redhat.com>
PR gas/3041
* aoutx.h (swap_std_reloc_out): Treat relocs against weak symbols
in the same way as relocs against external symbols.
2007-05-02 Alan Modra <amodra@bigpond.net.au>
* elf.c (assign_file_positions_for_load_sections): Set sh_offset

View File

@ -1952,7 +1952,10 @@ NAME (aout, swap_std_reloc_out) (bfd *abfd,
if (bfd_is_com_section (output_section)
|| bfd_is_abs_section (output_section)
|| bfd_is_und_section (output_section))
|| bfd_is_und_section (output_section)
/* PR gas/3041 a.out relocs against weak symbols
must be treated as if they were against externs. */
|| (sym->flags & BSF_WEAK))
{
if (bfd_abs_section_ptr->symbol == sym)
{

View File

@ -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

View File

@ -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