mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-21 02:24:17 +08:00
[PR ld/22269] arm: Avoid dynamic relocs for undefweak symbols in static PIE
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: PR ld/22269 * elf32-arm.c (elf32_arm_final_link_relocate): Use UNDEFWEAK_NO_DYNAMIC_RELOC. (allocate_dynrelocs_for_symbol): Likewise.
This commit is contained in:
@ -1,3 +1,10 @@
|
|||||||
|
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.
|
||||||
|
|
||||||
2020-01-10 Tamar Christina <tamar.christina@arm.com>
|
2020-01-10 Tamar Christina <tamar.christina@arm.com>
|
||||||
|
|
||||||
PR 25210
|
PR 25210
|
||||||
|
@ -11578,8 +11578,7 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
|
|||||||
if (dynreloc_st_type == STT_GNU_IFUNC)
|
if (dynreloc_st_type == STT_GNU_IFUNC)
|
||||||
outrel.r_info = ELF32_R_INFO (0, R_ARM_IRELATIVE);
|
outrel.r_info = ELF32_R_INFO (0, R_ARM_IRELATIVE);
|
||||||
else if (bfd_link_pic (info)
|
else if (bfd_link_pic (info)
|
||||||
&& (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|
&& !UNDEFWEAK_NO_DYNAMIC_RELOC (info, h))
|
||||||
|| h->root.type != bfd_link_hash_undefweak))
|
|
||||||
outrel.r_info = ELF32_R_INFO (0, R_ARM_RELATIVE);
|
outrel.r_info = ELF32_R_INFO (0, R_ARM_RELATIVE);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -16452,8 +16451,7 @@ allocate_dynrelocs_for_symbol (struct elf_link_hash_entry *h, void * inf)
|
|||||||
GOT entry's R_ARM_IRELATIVE relocation. */
|
GOT entry's R_ARM_IRELATIVE relocation. */
|
||||||
elf32_arm_allocate_irelocs (info, htab->root.srelgot, 1);
|
elf32_arm_allocate_irelocs (info, htab->root.srelgot, 1);
|
||||||
else if (bfd_link_pic (info)
|
else if (bfd_link_pic (info)
|
||||||
&& (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|
&& !UNDEFWEAK_NO_DYNAMIC_RELOC (info, h))
|
||||||
|| h->root.type != bfd_link_hash_undefweak))
|
|
||||||
/* Reserve room for the GOT entry's R_ARM_RELATIVE relocation. */
|
/* Reserve room for the GOT entry's R_ARM_RELATIVE relocation. */
|
||||||
elf32_arm_allocate_dynrelocs (info, htab->root.srelgot, 1);
|
elf32_arm_allocate_dynrelocs (info, htab->root.srelgot, 1);
|
||||||
else if (htab->fdpic_p && tls_type == GOT_NORMAL)
|
else if (htab->fdpic_p && tls_type == GOT_NORMAL)
|
||||||
|
Reference in New Issue
Block a user