summaryrefslogtreecommitdiff
path: root/bfd/elf32-i386.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2003-05-05 14:12:05 +0000
committerAlan Modra <amodra@bigpond.net.au>2003-05-05 14:12:05 +0000
commit17ef9676aa1da8891ab257ad774f497ccac94061 (patch)
treecd4087b78b3b4cca3a8ffdfae5626f14a3cd1d99 /bfd/elf32-i386.c
parentcf55488ed2e506077a5f6506a4c347d8e9aa1cf0 (diff)
downloadgdb-17ef9676aa1da8891ab257ad774f497ccac94061.tar.gz
* elf32-i386.c (allocate_dynrelocs): For undef weak syms with
non-default visibility, a) don't make them dynamic, b) discard space for dynamic relocs. * elf64-x86-64.c (allocate_dynrelocs): Likewise. * elf32-ppc.c (allocate_dynrelocs): For undef weak syms with non-default visibility, a) don't allocate plt entries, b) don't allocate .got relocs, c) discard dyn rel space, (ppc_elf_relocate_section): d) don't generate .got relocs, e) don't generate dynamic relocs. * elf64-ppc.c (allocate_dynrelocs): As above. (ppc64_elf_relocate_section): As above.
Diffstat (limited to 'bfd/elf32-i386.c')
-rw-r--r--bfd/elf32-i386.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index ac292a1a9e0..320e9859839 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -1558,7 +1558,9 @@ allocate_dynrelocs (h, inf)
htab = elf_i386_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. */
@@ -1569,10 +1571,8 @@ allocate_dynrelocs (h, inf)
return FALSE;
}
- if ((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
- || h->root.type != bfd_link_hash_undefweak)
- && (info->shared
- || WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, 0, h)))
+ if (info->shared
+ || WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, 0, h))
{
asection *s = htab->splt;
@@ -1695,6 +1695,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 if (ELIMINATE_COPY_RELOCS)
{