[patch] [rfa] Fix ld "weak symbols" test for sh-elf.
Hans-Peter Nilsson
hp@bitrange.com
Sun Oct 29 09:03:00 GMT 2000
More information about the Binutils mailing list
Sun Oct 29 09:03:00 GMT 2000
- Previous message (by thread): core dump in h8300-rtems-ld (coff) (binutils 2.10)
- Next message (by thread): [patch] [rfa] Fix ld "weak symbols" test for sh-elf.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
This is a fix to the "weak symbols" test in ld. Comment in patch should clarify. It does not handle brokenness (if any) for other object formats, particularly COFF. (There's a big scary comment with scary COFF-specific kludges in bfd_install_relocation.) Note that sh emits non-zero stuff in-place in the object file for relocations, despite being RELA. Ok to commit? 2000-10-29 Hans-Peter Nilsson <hp@bitrange.com> * config/tc-sh.c (md_apply_fix): For ELF, do not "adjust back" VAL for weak symbols. Index: tc-sh.c =================================================================== RCS file: /cvs/src/src/gas/config/tc-sh.c,v retrieving revision 1.25 diff -p -c -r1.25 tc-sh.c *** tc-sh.c 2000/10/25 19:15:33 1.25 --- tc-sh.c 2000/10/29 16:51:23 *************** md_apply_fix (fixP, val) *** 2767,2774 **** /* The function adjust_reloc_syms won't convert a reloc against a weak symbol into a reloc against a section, but bfd_install_relocation will screw up if the symbol is defined, so we have to adjust val here ! to avoid the screw up later. */ ! if (fixP->fx_addsy != NULL && S_IS_WEAK (fixP->fx_addsy)) val -= S_GET_VALUE (fixP->fx_addsy); #endif --- 2764,2780 ---- /* The function adjust_reloc_syms won't convert a reloc against a weak symbol into a reloc against a section, but bfd_install_relocation will screw up if the symbol is defined, so we have to adjust val here ! to avoid the screw up later. ! ! For ordinary relocs, this does not happen for ELF, since for ELF, ! bfd_install_relocation uses the "special function" field of the ! howto, and does not execute the code that needs to be undone, as long ! as the special function does not return bfd_reloc_continue. ! It can happen for GOT- and PLT-type relocs the way they are ! described in elf32-sh.c as they use bfd_elf_generic_reloc, but it ! doesn't matter here since those relocs don't use VAL; see below. */ ! if (OUTPUT_FLAVOR != bfd_target_elf_flavour ! && fixP->fx_addsy != NULL && S_IS_WEAK (fixP->fx_addsy)) val -= S_GET_VALUE (fixP->fx_addsy); #endif brgds, H-P
- Previous message (by thread): core dump in h8300-rtems-ld (coff) (binutils 2.10)
- Next message (by thread): [patch] [rfa] Fix ld "weak symbols" test for sh-elf.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Binutils mailing list