From bb1dd176fb6f38ae3cc30dc61ce55a7fbf9d0d7b Mon Sep 17 00:00:00 2001 From: Qing Zhao Date: Mon, 10 Apr 2017 12:46:30 +0100 Subject: Port the bug fix for PR 19704 (Missing dynamic relocation against undefined weak symbol) to the SPARC architecture. * elf32-sparc.c (elf_backend_fixup_symbol): New. * elf64-sparc.c (elf_backend_fixup_symbol): New. * elfxx-sparc.c (UNDEFINED_WEAK_RESOLVED_TO_ZERO): New. (_bfd_sparc_elf_link_hash_entry): Add has_got_reloc and has_non_got_reloc. (link_hash_newfunc): Initialize has_got_reloc and has_non_got_reloc. (_bfd_sparc_elf_size_dynamic_sections): Set interp to .interp section. (_bfd_sparc_elf_copy_indirect_symbol): Copy has_got_reloc and has_non_got_reloc. (_bfd_sparc_elf_check_relocs): Set has_got_reloc and has_non_got_reloc. (_bfd_sparc_elf_fixup_symbol): New function. (allocate_dynrelocs): Don't allocate space for dynamic relocations and discard relocations against resolved undefined weak symbols in executable. Don't make resolved undefined weak symbols in executable dynamic. Keep dynamic non-GOT/non-PLT relocation against undefined weak symbols in PIE. (_bfd_sparc_elf_relocate_section): Don't generate dynamic relocations against resolved undefined weak symbols in PIE (_bfd_sparc_elf_finish_dynamic_symbol): Keep PLT/GOT entries without ynamic PLT/GOT relocations for resolved undefined weak symbols. Don't generate dynamic relocation against resolved undefined weak symbol in executable. (pie_finish_undefweak_symbol): New function. (_bfd_sparc_elf_finish_dynamic_sections): Call pie_finish_undefweak_symbol on all symbols in PIE. * elfxx-sparc.h (_bfd_sparc_elf_link_hash_table): Add interp. (_bfd_sparc_elf_fixup_symbol): New function. --- bfd/elf64-sparc.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'bfd/elf64-sparc.c') diff --git a/bfd/elf64-sparc.c b/bfd/elf64-sparc.c index 0190bd2..7425dbe 100644 --- a/bfd/elf64-sparc.c +++ b/bfd/elf64-sparc.c @@ -904,6 +904,8 @@ const struct elf_size_info elf64_sparc_size_info = _bfd_sparc_elf_finish_dynamic_symbol #define elf_backend_finish_dynamic_sections \ _bfd_sparc_elf_finish_dynamic_sections +#define elf_backend_fixup_symbol \ + _bfd_sparc_elf_fixup_symbol #define bfd_elf64_mkobject \ _bfd_sparc_elf_mkobject -- cgit v1.1