aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite
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 /ld/testsuite
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 'ld/testsuite')
-rw-r--r--ld/testsuite/ChangeLog5
-rw-r--r--ld/testsuite/ld-elf/needed3.c8
-rw-r--r--ld/testsuite/ld-elf/shared.exp12
3 files changed, 25 insertions, 0 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index c52203a..6b6e8f7 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2014-08-18 Alan Modra <amodra@gmail.com>
+
+ * ld-plugin/needed3.c: New file.
+ * ld-elf/shared.exp: Add needed3 test.
+
2014-08-12 Alan Modra <amodra@gmail.com>
* lib/ld-lib.exp (check_plugin_api_available): Match "-plugin PLUGIN".
diff --git a/ld/testsuite/ld-elf/needed3.c b/ld/testsuite/ld-elf/needed3.c
new file mode 100644
index 0000000..cbb9d56
--- /dev/null
+++ b/ld/testsuite/ld-elf/needed3.c
@@ -0,0 +1,8 @@
+extern void foo (void);
+
+int
+main ()
+{
+ foo ();
+ return 0;
+}
diff --git a/ld/testsuite/ld-elf/shared.exp b/ld/testsuite/ld-elf/shared.exp
index de2a5f2..b55856a 100644
--- a/ld/testsuite/ld-elf/shared.exp
+++ b/ld/testsuite/ld-elf/shared.exp
@@ -222,6 +222,18 @@ set build_tests {
{"Build needed2"
"tmpdir/libneeded2c.o -Wl,--as-needed tmpdir/libneeded2a.so tmpdir/libneeded2b.so" ""
{dummy.c} {} "needed2"}
+ {"Build libneeded3a.so"
+ "-shared -Wl,--no-add-needed" "-fPIC"
+ {needed1a.c} {} "libneeded3a.so"}
+ {"Build libneeded3b.so"
+ "-shared -Wl,--no-as-needed,--add-needed -Ltmpdir -lneeded1b" "-fPIC"
+ {dummy.c} {} "libneeded3b.so"}
+ {"Build needed3.o"
+ "-r -nostdlib" ""
+ {needed3.c} {} "libneeded3.so"}
+ {"Build needed3"
+ "tmpdir/needed3.o -Wl,--as-needed -Ltmpdir -lneeded3a -lneeded3b -lneeded1b" ""
+ {dummy.c} {} "needed3"}
{"Build libpr2404a.so"
"-shared" "-fPIC"
{pr2404a.c} {} "libpr2404a.so"}