aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf64-s390.c
diff options
context:
space:
mode:
authorMartin Schwidefsky <schwidefsky@de.ibm.com>2003-05-09 15:17:54 +0000
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2003-05-09 15:17:54 +0000
commit82058a735bbff6d114ab25e828e9c500abea87ac (patch)
treecccfe988507ba3910ed085cefece5c64c0def1e8 /bfd/elf64-s390.c
parent8373f9713f3d2f523a144cdb0c2024b9275f2af4 (diff)
downloadfsf-binutils-gdb-82058a735bbff6d114ab25e828e9c500abea87ac.zip
fsf-binutils-gdb-82058a735bbff6d114ab25e828e9c500abea87ac.tar.gz
fsf-binutils-gdb-82058a735bbff6d114ab25e828e9c500abea87ac.tar.bz2
* elf32-s390.c (allocate_dynrelocs): For undef weak syms with
non-default visibility, a) don't make them dynamic, b) discard space for dynamic relocs. (elf_s390_relocate_section): Initialize the GOT entries and skip R_390_{8,16,32}/R_390_PC{16,16DBL,32DBL,32} for weak undefined symbols with non-default visibility. * elf64-s390.c: Likewise.
Diffstat (limited to 'bfd/elf64-s390.c')
-rw-r--r--bfd/elf64-s390.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c
index 37fcf72..1c10643 100644
--- a/bfd/elf64-s390.c
+++ b/bfd/elf64-s390.c
@@ -1623,7 +1623,9 @@ allocate_dynrelocs (h, inf)
htab = elf_s390_hash_table (info);
if (htab->elf.dynamic_sections_created
- && h->plt.refcount > 0)
+ && h->plt.refcount > 0
+ && (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+ || h->root.type != bfd_link_hash_undefweak))
{
/* Make sure this symbol is output as a dynamic symbol.
Undefined weak syms won't yet be marked as dynamic. */
@@ -1634,7 +1636,8 @@ allocate_dynrelocs (h, inf)
return FALSE;
}
- if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info, h))
+ if (info->shared
+ || WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info, h))
{
asection *s = htab->splt;
@@ -1730,7 +1733,10 @@ allocate_dynrelocs (h, inf)
htab->srelgot->_raw_size += sizeof (Elf64_External_Rela);
else if (tls_type == GOT_TLS_GD)
htab->srelgot->_raw_size += 2 * sizeof (Elf64_External_Rela);
- else if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, h))
+ else if ((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+ || h->root.type != bfd_link_hash_undefweak)
+ && (info->shared
+ || WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h)))
htab->srelgot->_raw_size += sizeof (Elf64_External_Rela);
}
else
@@ -1764,6 +1770,12 @@ allocate_dynrelocs (h, inf)
pp = &p->next;
}
}
+
+ /* Also discard relocs on undefined weak syms with non-default
+ visibility. */
+ if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
+ && h->root.type == bfd_link_hash_undefweak)
+ eh->dyn_relocs = NULL;
}
else
{
@@ -2279,7 +2291,9 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
&& (info->symbolic
|| h->dynindx == -1
|| (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL))
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)))
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))
+ || (ELF_ST_VISIBILITY (h->other)
+ && h->root.type == bfd_link_hash_undefweak))
{
/* This is actually a static link, or it is a
-Bsymbolic link and the symbol is defined
@@ -2449,6 +2463,9 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
break;
if ((info->shared
+ && (h == NULL
+ || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+ || h->root.type != bfd_link_hash_undefweak)
&& ((r_type != R_390_PC16
&& r_type != R_390_PC16DBL
&& r_type != R_390_PC32