This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH, ARM] Fix ld-elfvsb hidden_weak test failure.
- From: Will Newton <will dot newton at linaro dot org>
- To: binutils at sourceware dot org
- Date: Wed, 20 Mar 2013 15:48:52 +0000
- Subject: [PATCH, ARM] Fix ld-elfvsb hidden_weak test failure.
This test currently fails for ARM, The reason for the failure appears to be
that the PLT call is elided from the output (we are calling a hidden undefined
weak) but the function pointer test causes a R_ARM_RELATIVE dynamic reloc to
be emitted which ldso then fixes up, adding in the load address and thus
making the pointer non-zero - so the value of the pointer is non-NULL, but
there is no function to call.
Tested on armv7l-unknown-linux-gnueabihf.
bfd/ChangeLog:
2013-03-20 Will Newton <will.newton@linaro.org>
* elf32-arm.c (elf32_arm_final_link_relocate): Avoid emitting a
dynamic reloc for non-default visibility undefined weaks.
(allocate_dynrelocs_for_symbol): Avoid allocating space for a
dynamic reloc for non-default visibility undefined weaks.
---
bfd/elf32-arm.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index aba1814..aa60a3f 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -9158,7 +9158,9 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
{
if (dynreloc_st_type == STT_GNU_IFUNC)
outrel.r_info = ELF32_R_INFO (0, R_ARM_IRELATIVE);
- else if (info->shared)
+ else if (info->shared &&
+ (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+ || h->root.type != bfd_link_hash_undefweak))
outrel.r_info = ELF32_R_INFO (0, R_ARM_RELATIVE);
else
outrel.r_info = 0;
@@ -13270,7 +13272,8 @@ allocate_dynrelocs_for_symbol (struct elf_link_hash_entry *h, void * inf)
they all resolve dynamically instead. Reserve room for the
GOT entry's R_ARM_IRELATIVE relocation. */
elf32_arm_allocate_irelocs (info, htab->root.srelgot, 1);
- else if (info->shared)
+ else if (info->shared && (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+ || h->root.type != bfd_link_hash_undefweak))
/* Reserve room for the GOT entry's R_ARM_RELATIVE relocation. */
elf32_arm_allocate_dynrelocs (info, htab->root.srelgot, 1);
}
--
1.8.1.4