aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2012-12-06 00:25:19 +0000
committerH.J. Lu <hjl.tools@gmail.com>2012-12-06 00:25:19 +0000
commit8fbb09e83e588193462a3c488466cb4d1a80ba98 (patch)
treebef3fb09a0e9c740386776d7ad5f3769b6a4490c /ld/testsuite
parent5c3ab52b3b9b0c3ff205d5eb0cd3530b315f517c (diff)
downloadgdb-8fbb09e83e588193462a3c488466cb4d1a80ba98.zip
gdb-8fbb09e83e588193462a3c488466cb4d1a80ba98.tar.gz
gdb-8fbb09e83e588193462a3c488466cb4d1a80ba98.tar.bz2
Extend --copy-dt-needed-entries to creating DSO
ld/ PR ld/14915 * emultempl/elf32.em (gld${EMULATION_NAME}_after_open): Also check DT_NEEDED entries when creating shared object with --copy-dt-needed-entries. ld/testsuite/ PR ld/14915 * ld-elf/shared.exp (build_tests): Test --add-needed, --copy-dt-needed-entries, --no-add-needed and --no-copy-dt-needed-entries with -shared. Add tests for --no-add-needed and --no-copy-dt-needed-entries with -shared.
Diffstat (limited to 'ld/testsuite')
-rw-r--r--ld/testsuite/ChangeLog9
-rw-r--r--ld/testsuite/ld-elf/shared.exp29
2 files changed, 38 insertions, 0 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 5b1bc8f..64632bc 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,12 @@
+2012-12-05 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/14915
+ * ld-elf/shared.exp (build_tests): Test --add-needed,
+ --copy-dt-needed-entries, --no-add-needed and
+ --no-copy-dt-needed-entries with -shared.
+ Add tests for --no-add-needed and --no-copy-dt-needed-entries
+ with -shared.
+
2012-12-06 Alan Modra <amodra@gmail.com>
* ld-elf/comm-data4.d, ld-elf/comm-data4.s: New test.
diff --git a/ld/testsuite/ld-elf/shared.exp b/ld/testsuite/ld-elf/shared.exp
index 2e679d9..eef264e 100644
--- a/ld/testsuite/ld-elf/shared.exp
+++ b/ld/testsuite/ld-elf/shared.exp
@@ -188,6 +188,21 @@ set build_tests {
{"Build libneeded1c.o"
"-r -nostdlib" ""
{needed1c.c} {} "libneeded1c.o"}
+ {"Build libneeded1pic.o"
+ "-r -nostdlib" "-fPIC"
+ {needed1c.c} {} "libneeded1pic.o"}
+ {"Build needed1a.so with --add-needed"
+ "-shared tmpdir/libneeded1pic.o -Wl,--add-needed,-rpath=tmpdir,-z,defs -Ltmpdir -lneeded1a" ""
+ {dummy.c} {} "needed1a.so"}
+ {"Build needed1b.so with --copy-dt-needed-entries"
+ "-shared tmpdir/libneeded1pic.o -Wl,--copy-dt-needed-entries,-rpath=tmpdir,-z,defs -Ltmpdir -lneeded1a" ""
+ {dummy.c} {} "needed1b.so"}
+ {"Build needed1a.so with --no-add-needed"
+ "-shared tmpdir/libneeded1pic.o -Wl,--no-add-needed -Ltmpdir -lneeded1a" ""
+ {dummy.c} {} "needed1c.so"}
+ {"Build needed1b.so with --no-copy-dt-needed-entries"
+ "-shared tmpdir/libneeded1pic.o -Wl,--no-copy-dt-needed-entries -Ltmpdir -lneeded1a" ""
+ {dummy.c} {} "needed1d.so"}
}
run_cc_link_tests $build_tests
@@ -352,6 +367,20 @@ if { [ regexp "'bar' is defined in DSO tmpdir/libneeded1b.so" $exec_output ] } {
} {
fail $testname
}
+set testname "--no-add-needed -shared"
+set exec_output [run_host_cmd "$CC" "$gcc_gas_flag $gcc_ld_flag -shared tmpdir/libneeded1pic.o -Wl,--no-add-needed,-z,defs -Ltmpdir -lneeded1a"]
+if { [ regexp "undefined reference to `bar'" $exec_output ] } {
+ pass $testname
+} {
+ fail $testname
+}
+set testname "--no-copy-dt-needed-entries -shared"
+set exec_output [run_host_cmd "$CC" "$gcc_gas_flag $gcc_ld_flag -shared tmpdir/libneeded1pic.o -Wl,--no-copy-dt-needed-entries,-z,defs -Ltmpdir -lneeded1a"]
+if { [ regexp "undefined reference to `bar'" $exec_output ] } {
+ pass $testname
+} {
+ fail $testname
+}
# Check to see if the C++ compiler works
if { [which $CXX] == 0 } {