summaryrefslogtreecommitdiff
path: root/bfd/elfxx-target.h
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@imgtec.com>2017-04-24 20:15:31 +0100
committerMaciej W. Rozycki <macro@imgtec.com>2017-04-26 13:17:07 +0100
commit23ec1e32b1ab714649a7c25e49b5d721fe3bd3db (patch)
tree86f02a16d136cb6895ca179e1ba5d9e8dda7ccc7 /bfd/elfxx-target.h
parentc46cec3a8cfe02fbe0f6c67ba53abc5369c5c659 (diff)
downloadbinutils-gdb-23ec1e32b1ab714649a7c25e49b5d721fe3bd3db.tar.gz
PR ld/21334: Always call `_bfd_elf_link_renumber_dynsyms' if required
Complement commit e17b0c351f0b ("MIPS/BFD: Respect the ELF gABI dynamic symbol table sort requirement") and correct an inconsistency in dynamic symbol accounting data causing an assertion failure in the MIPS backend: ld: BFD (GNU Binutils) 2.28.51.20170330 assertion fail ../../binutils-gdb/bfd/elfxx-mips.c:3860 in the course of making a GOT entry in a static binary to satisfy a GOT relocation present in input, due to the local dynamic symbol count not having been established. To do so let backends request `_bfd_elf_link_renumber_dynsyms' to be always called, rather than where a dynamic binary is linked only, and then make this request in the MIPS backend. bfd/ PR ld/21334 * elf-bfd.h (elf_backend_data): Add `always_renumber_dynsyms' member. * elfxx-target.h [!elf_backend_always_renumber_dynsyms] (elf_backend_always_renumber_dynsyms): Define. (elfNN_bed): Initialize `always_renumber_dynsyms' member. * elfxx-mips.h (elf_backend_always_renumber_dynsyms): Define. * elflink.c (bfd_elf_size_dynamic_sections): Also call `_bfd_elf_link_renumber_dynsyms' if the backend has requested it. (bfd_elf_size_dynsym_hash_dynstr): Likewise. ld/ PR ld/21334 * testsuite/ld-mips-elf/pr21334.dd: New test. * testsuite/ld-mips-elf/pr21334.gd: New test. * testsuite/ld-mips-elf/pr21334.ld: New test linker script. * testsuite/ld-mips-elf/pr21334.s: New test source. * testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.
Diffstat (limited to 'bfd/elfxx-target.h')
-rw-r--r--bfd/elfxx-target.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/bfd/elfxx-target.h b/bfd/elfxx-target.h
index 25512671a68..2e24e119459 100644
--- a/bfd/elfxx-target.h
+++ b/bfd/elfxx-target.h
@@ -126,6 +126,9 @@
#ifndef elf_backend_extern_protected_data
#define elf_backend_extern_protected_data 0
#endif
+#ifndef elf_backend_always_renumber_dynsyms
+#define elf_backend_always_renumber_dynsyms FALSE
+#endif
#ifndef elf_backend_stack_align
#define elf_backend_stack_align 16
#endif
@@ -878,7 +881,8 @@ static struct elf_backend_data elfNN_bed =
elf_backend_no_page_alias,
elf_backend_default_execstack,
elf_backend_caches_rawsize,
- elf_backend_extern_protected_data
+ elf_backend_extern_protected_data,
+ elf_backend_always_renumber_dynsyms
};
/* Forward declaration for use when initialising alternative_target field. */