summaryrefslogtreecommitdiff
path: root/bfd/elflink.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2016-02-01 15:49:52 -0800
committerH.J. Lu <hjl.tools@gmail.com>2016-02-20 09:38:18 -0800
commitaa0e2cd3fc823673081d6dbf9f0a38ff4b2fc437 (patch)
tree82a5025872d853a70e192c70749db8d5ae255189 /bfd/elflink.c
parentd45389bc26e27dbb54f19eb3bd530f0dc8c9f20d (diff)
downloadbinutils-gdb-users/hjl/pr19553/binutils-2_26-branch.tar.gz
Don't add DT_NEEDED for unmatched symbolusers/hjl/pr19553/binutils-2_26-branch
Don't add DT_NEEDED if a symbol from a library loaded via DT_NEEDED doesn't match the symbol referenced by regular object. Backport from master bfd/ PR ld/19553 * elflink.c (elf_link_add_object_symbols): Don't add DT_NEEDED if a symbol from a library loaded via DT_NEEDED doesn't match the symbol referenced by regular object. ld/testsuite/ PR ld/19553 * testsuite/ld-elf/indirect.exp: Run tests for PR ld/19553. * testsuite/ld-elf/pr19553.map: New file. * testsuite/ld-elf/pr19553.map: Likewise. * testsuite/ld-elf/pr19553a.c: Likewise. * testsuite/ld-elf/pr19553b.c: Likewise. * testsuite/ld-elf/pr19553b.out: Likewise. * testsuite/ld-elf/pr19553c.c: Likewise. * testsuite/ld-elf/pr19553c.out: Likewise. * testsuite/ld-elf/pr19553d.c: Likewise. * testsuite/ld-elf/pr19553d.out: Likewise.
Diffstat (limited to 'bfd/elflink.c')
-rw-r--r--bfd/elflink.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 3d37bb42253..ae8d148ab99 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -4562,8 +4562,10 @@ error_free_dyn:
break;
}
- /* Don't add DT_NEEDED for references from the dummy bfd. */
+ /* Don't add DT_NEEDED for references from the dummy bfd nor
+ for unmatched symbol. */
if (!add_needed
+ && matched
&& definition
&& ((dynsym
&& h->ref_regular_nonweak