diff options
author | Alan Modra <amodra@bigpond.net.au> | 2006-02-21 01:51:59 +0000 |
---|---|---|
committer | Alan Modra <amodra@bigpond.net.au> | 2006-02-21 01:51:59 +0000 |
commit | 9546b34fd943c6981a74f94789771d34898ef5e3 (patch) | |
tree | f6697764b45ba18ec5d0625b51db5e114455b0d0 /bfd/elf32-i386.c | |
parent | 8471fe473723a4dadcd0e47702810325b3a5962d (diff) | |
download | gdb-9546b34fd943c6981a74f94789771d34898ef5e3.tar.gz |
PR ld/2218
* elf32-arm.c (allocate_dynrelocs): Ensure undef weak sym in pie
is dynamic.
* elf32-hppa.c (allocate_dynrelocs): Likewise.
* elf32-i386.c (allocate_dynrelocs): Likewise.
* elf32-s390.c (allocate_dynrelocs): Likewise.
* elf32-sh.c (allocate_dynrelocs): Likewise.
* elf64-s390.c (allocate_dynrelocs): Likewise.
* elf64-x86-64.c (allocate_dynrelocs): Likewise.
* elf32-m32r.c (allocate_dynrelocs): Likewise. Discard relocs
on undef weak with non-default visibility too.
* elfxx-sparc.c (allocate_dynrelocs): Ditto.
Diffstat (limited to 'bfd/elf32-i386.c')
-rw-r--r-- | bfd/elf32-i386.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index b8e87909282..64e5fb0d2af 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -1779,9 +1779,21 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) /* Also discard relocs on undefined weak syms with non-default visibility. */ - if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT + if (eh->dyn_relocs != NULL && h->root.type == bfd_link_hash_undefweak) - eh->dyn_relocs = NULL; + { + if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT) + eh->dyn_relocs = NULL; + + /* Make sure undefined weak symbols are output as a dynamic + symbol in PIEs. */ + else if (h->dynindx == -1 + && !h->forced_local) + { + if (! bfd_elf_link_record_dynamic_symbol (info, h)) + return FALSE; + } + } } else if (ELIMINATE_COPY_RELOCS) { |