aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2013-12-11 08:00:34 -0800
committerH.J. Lu <hjl.tools@gmail.com>2013-12-11 08:00:34 -0800
commit5e319dd3e18e1318ab97a2dabb93095e2bd82ee3 (patch)
tree8210e2e9e5e74851865cdd321d3a97d10859283c /ld/testsuite
parent08a6411c715c2d8bf31d5a5c8a477fa4651639aa (diff)
downloadgdb-5e319dd3e18e1318ab97a2dabb93095e2bd82ee3.zip
gdb-5e319dd3e18e1318ab97a2dabb93095e2bd82ee3.tar.gz
gdb-5e319dd3e18e1318ab97a2dabb93095e2bd82ee3.tar.bz2
Add a test for --as-needed with symbol versioning
* ld-elf/shared.exp (build_tests): Add libneeded2a.so, libneeded2b.so, libneeded2c.o and needed2. * ld-elf/needed2.ver: New file. * ld-elf/needed2a.c: Likewise. * ld-elf/needed2b.c: Likewise. * ld-elf/needed2c.c: Likewise.
Diffstat (limited to 'ld/testsuite')
-rw-r--r--ld/testsuite/ChangeLog10
-rw-r--r--ld/testsuite/ld-elf/needed2.ver4
-rw-r--r--ld/testsuite/ld-elf/needed2a.c5
-rw-r--r--ld/testsuite/ld-elf/needed2b.c2
-rw-r--r--ld/testsuite/ld-elf/needed2c.c6
-rw-r--r--ld/testsuite/ld-elf/shared.exp12
6 files changed, 39 insertions, 0 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 4526b4e..d00d170 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,13 @@
+2013-12-11 H.J. Lu <hongjiu.lu@intel.com>
+
+ * ld-elf/shared.exp (build_tests): Add libneeded2a.so,
+ libneeded2b.so, libneeded2c.o and needed2.
+
+ * ld-elf/needed2.ver: New file.
+ * ld-elf/needed2a.c: Likewise.
+ * ld-elf/needed2b.c: Likewise.
+ * ld-elf/needed2c.c: Likewise.
+
2013-12-07 Mike Frysinger <vapier@gentoo.org>
* ld-pe/aligncomm-1.c: Remove +x file mode.
diff --git a/ld/testsuite/ld-elf/needed2.ver b/ld/testsuite/ld-elf/needed2.ver
new file mode 100644
index 0000000..a68b3d9
--- /dev/null
+++ b/ld/testsuite/ld-elf/needed2.ver
@@ -0,0 +1,4 @@
+BLAFOO {
+ global: pam_end;
+ local: *;
+};
diff --git a/ld/testsuite/ld-elf/needed2a.c b/ld/testsuite/ld-elf/needed2a.c
new file mode 100644
index 0000000..538cb22
--- /dev/null
+++ b/ld/testsuite/ld-elf/needed2a.c
@@ -0,0 +1,5 @@
+extern void pam_end (void);
+void dumpme (void)
+{
+ pam_end ();
+}
diff --git a/ld/testsuite/ld-elf/needed2b.c b/ld/testsuite/ld-elf/needed2b.c
new file mode 100644
index 0000000..50c2588
--- /dev/null
+++ b/ld/testsuite/ld-elf/needed2b.c
@@ -0,0 +1,2 @@
+extern void pam_end (void);
+void pam_end (void) {}
diff --git a/ld/testsuite/ld-elf/needed2c.c b/ld/testsuite/ld-elf/needed2c.c
new file mode 100644
index 0000000..e43b0d5
--- /dev/null
+++ b/ld/testsuite/ld-elf/needed2c.c
@@ -0,0 +1,6 @@
+extern void dumpme (void);
+int main (void)
+{
+ dumpme();
+ return 0;
+}
diff --git a/ld/testsuite/ld-elf/shared.exp b/ld/testsuite/ld-elf/shared.exp
index 56c724f..3162547 100644
--- a/ld/testsuite/ld-elf/shared.exp
+++ b/ld/testsuite/ld-elf/shared.exp
@@ -206,6 +206,18 @@ set build_tests {
{"Build librel.so"
"-shared" "-fPIC"
{rel.c} {} "librel.so"}
+ {"Build libneeded2a.so"
+ "-shared" "-fPIC"
+ {needed2a.c} {} "libneeded2a.so"}
+ {"Build libneeded2b.so"
+ "-shared -Wl,--version-script,needed2.ver" "-fPIC"
+ {needed2b.c} {} "libneeded2b.so"}
+ {"Build libneeded2c.o"
+ "-r -nostdlib" ""
+ {needed2c.c} {} "libneeded2c.o"}
+ {"Build needed2"
+ "tmpdir/libneeded2c.o -Wl,--as-needed tmpdir/libneeded2a.so tmpdir/libneeded2b.so" ""
+ {dummy.c} {} "needed2"}
}
run_cc_link_tests $build_tests