diff options
author | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2003-05-09 15:17:54 +0000 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2003-05-09 15:17:54 +0000 |
commit | 82058a735bbff6d114ab25e828e9c500abea87ac (patch) | |
tree | cccfe988507ba3910ed085cefece5c64c0def1e8 /bfd/elf32-s390.c | |
parent | 8373f9713f3d2f523a144cdb0c2024b9275f2af4 (diff) | |
download | gdb-82058a735bbff6d114ab25e828e9c500abea87ac.zip gdb-82058a735bbff6d114ab25e828e9c500abea87ac.tar.gz 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/elf32-s390.c')
-rw-r--r-- | bfd/elf32-s390.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c index 857b7a0..0ee371a 100644 --- a/bfd/elf32-s390.c +++ b/bfd/elf32-s390.c @@ -1651,7 +1651,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. */ @@ -1662,7 +1664,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; @@ -1758,7 +1761,10 @@ allocate_dynrelocs (h, inf) htab->srelgot->_raw_size += sizeof (Elf32_External_Rela); else if (tls_type == GOT_TLS_GD) htab->srelgot->_raw_size += 2 * sizeof (Elf32_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 (Elf32_External_Rela); } else @@ -1792,6 +1798,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 { @@ -2306,7 +2318,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 @@ -2471,6 +2485,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_PC32DBL |