[PATCH] [PR ld/22269] arm: Avoid dynamic relocs for undefweak symbols in static PIE

Szabolcs Nagy Szabolcs.Nagy@arm.com
Fri Jan 10 10:08:00 GMT 2020


With static PIE linking undefined weak symbols are resolved to 0, so no
dynamic relocation is needed for them. The UNDEFWEAK_NO_DYNAMIC_RELOC
macro was introduced so this case can be handled easily, but it was not
applied consistently in the first attempt to fix ld/22269 for arm:

  commit 95b03e4ad68e7a90f5096b47df595636344b783a
  arm: Check UNDEFWEAK_NO_DYNAMIC_RELOC

This patch fixes spurious relative relocs in static PIE binaries against
GOT entries created for undefined weak symbols on arm*-*, this fixes

FAIL: pr22269-1 (static pie undefined weak)

bfd/ChangeLog:

2020-01-10  Szabolcs Nagy  <szabolcs.nagy@arm.com>

	PR ld/22269
	* elf32-arm.c (elf32_arm_final_link_relocate): Use
	UNDEFWEAK_NO_DYNAMIC_RELOC.
	(allocate_dynrelocs_for_symbol): Likewise.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-PR-ld-22269-arm-Avoid-dynamic-relocs-for-undefweak-s.diff
Type: text/x-patch
Size: 1206 bytes
Desc:  0001-PR-ld-22269-arm-Avoid-dynamic-relocs-for-undefweak-s.diff
URL: <https://sourceware.org/pipermail/binutils/attachments/20200110/df1d9259/attachment.bin>


More information about the Binutils mailing list