aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2024-02-12 07:51:48 +1030
committerAlan Modra <amodra@gmail.com>2024-02-16 07:55:23 +1030
commit74a7e2f31ac6bd8914b0c3f1c6c4c51017fefc02 (patch)
tree8556a348d551aa346b309979d7157cdddd5b9626 /bfd
parente70d6457a648c25d4382bcc030e9f5a94f3ca189 (diff)
downloadbinutils-74a7e2f31ac6bd8914b0c3f1c6c4c51017fefc02.zip
binutils-74a7e2f31ac6bd8914b0c3f1c6c4c51017fefc02.tar.gz
binutils-74a7e2f31ac6bd8914b0c3f1c6c4c51017fefc02.tar.bz2
S/390: 32-bit PIE undef weak failures
Like 10e7c0457cb7 but for elf32-s390.c * elf32-s390.c (elf_s390_adjust_dynamic_symbol): Use UNDEFWEAK_NO_DYNAMIC_RELOC. (allocate_dynrelocs): Likewise. (elf_s390_relocate_section): Check resolved_to_zero. (elf_s390_finish_dynamic_symbol): Don't generate runtime reloc if UNDEFWEAK_NO_DYNAMIC_RELOC.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/elf32-s390.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c
index 1a2ade0..bd9eb1e 100644
--- a/bfd/elf32-s390.c
+++ b/bfd/elf32-s390.c
@@ -1447,8 +1447,7 @@ elf_s390_adjust_dynamic_symbol (struct bfd_link_info *info,
{
if (h->plt.refcount <= 0
|| SYMBOL_CALLS_LOCAL (info, h)
- || (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
- && h->root.type != bfd_link_hash_undefweak))
+ || UNDEFWEAK_NO_DYNAMIC_RELOC (info, h))
{
/* This case can occur if we saw a PLT32 reloc in an input
file, but the symbol was never referred to by a dynamic
@@ -1677,8 +1676,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
htab->elf.srelgot->size += sizeof (Elf32_External_Rela);
else if (tls_type == GOT_TLS_GD)
htab->elf.srelgot->size += 2 * sizeof (Elf32_External_Rela);
- else if ((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
- || h->root.type != bfd_link_hash_undefweak)
+ else if (!UNDEFWEAK_NO_DYNAMIC_RELOC (info, h)
&& (bfd_link_pic (info)
|| WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h)))
htab->elf.srelgot->size += sizeof (Elf32_External_Rela);
@@ -2240,9 +2238,7 @@ elf_s390_relocate_section (bfd *output_bfd,
h)
|| (bfd_link_pic (info)
&& SYMBOL_REFERENCES_LOCAL (info, h))
- || (ELF_ST_VISIBILITY (h->other)
- && h->root.type == bfd_link_hash_undefweak))
-
+ || resolved_to_zero)
{
/* This is actually a static link, or it is a
-Bsymbolic link and the symbol is defined
@@ -3499,6 +3495,9 @@ elf_s390_finish_dynamic_symbol (bfd *output_bfd,
else if (bfd_link_pic (info)
&& SYMBOL_REFERENCES_LOCAL (info, h))
{
+ if (UNDEFWEAK_NO_DYNAMIC_RELOC (info, h))
+ return true;
+
/* If this is a static link, or it is a -Bsymbolic link and
the symbol is defined locally or was forced to be local
because of a version file, we just want to emit a