+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
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)
{
+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
/* 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.
#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 */
#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
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