aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2014-08-18 14:43:03 +0930
committerAlan Modra <amodra@gmail.com>2014-08-18 18:45:01 +0930
commit1240be6b7d0a5604c4e3efe12c9e1d08ebc246be (patch)
treea7f1bcd457894415ab539567c164dc1a93d09b1e /bfd
parent759388538d1339f6a634b2777e24f46427dd9c96 (diff)
downloadgdb-1240be6b7d0a5604c4e3efe12c9e1d08ebc246be.zip
gdb-1240be6b7d0a5604c4e3efe12c9e1d08ebc246be.tar.gz
gdb-1240be6b7d0a5604c4e3efe12c9e1d08ebc246be.tar.bz2
PR 17287, DT_NEEDED of unneeded libraries affects --as-needed
PR 17287 bfd/ * elflink.c (on_needed_list): Only consider libraries that have been loaded. ld/ * ld.texinfo (--as-needed): Clarify that references from libraries must be from needed libraries. ld/testsuite/ * ld-plugin/needed3.c: New file. * ld-elf/shared.exp: Add needed3 test.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/elflink.c3
2 files changed, 8 insertions, 1 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 508a20a..3c2ed57 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,11 @@
2014-08-18 Alan Modra <amodra@gmail.com>
+ PR 17287
+ * elflink.c (on_needed_list): Only consider libraries that have
+ been loaded.
+
+2014-08-18 Alan Modra <amodra@gmail.com>
+
* elflink.c (bfd_elf_discard_info): Return int error status.
* stabs.c (_bfd_discard_section_stabs): Comment typo fix.
* bfd-in.h (bfd_elf_discard_info): Updata prototype.
diff --git a/bfd/elflink.c b/bfd/elflink.c
index d20f357..c80ee82 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -3086,7 +3086,8 @@ static bfd_boolean
on_needed_list (const char *soname, struct bfd_link_needed_list *needed)
{
for (; needed != NULL; needed = needed->next)
- if (strcmp (soname, needed->name) == 0)
+ if ((elf_dyn_lib_class (needed->by) & DYN_AS_NEEDED) == 0
+ && strcmp (soname, needed->name) == 0)
return TRUE;
return FALSE;