Commit 1be438fd authored by Maciej W. Rozycki's avatar Maciej W. Rozycki
Browse files

PR ld/21334: Always call `_bfd_elf_link_renumber_dynsyms' if required

Complement commit e17b0c35 ("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_dynsym_hash_dynstr): Also call
	`_bfd_elf_link_renumber_dynsyms' if the backend has requested
	it.
	(elf_gc_sweep): Likewise.

(backported from commit 23ec1e32)
parent 2e1b086f
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment