aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2014-01-20 04:50:47 -0800
committerH.J. Lu <hjl.tools@gmail.com>2014-01-20 04:50:47 -0800
commitcec2c50d38391e11f7116643450156560e5a1b91 (patch)
treeacf4a69671db08b7fe90c6db7a23de483d6ca4d4
parente671835b7afc90b3ff201b79f07a6fb67797bc5c (diff)
downloadgdb-cec2c50d38391e11f7116643450156560e5a1b91.zip
gdb-cec2c50d38391e11f7116643450156560e5a1b91.tar.gz
gdb-cec2c50d38391e11f7116643450156560e5a1b91.tar.bz2
Add a testcase for PR ld/2404
PR ld/2404 was fixed without a testcase. This patch to add one. PR ld/2404 * ld-elf/pr2404.out: New file. * ld-elf/pr2404a.c: Likewise. * ld-elf/pr2404b.c: Likewise. * ld-elf/shared.exp (build_tests): Build libpr2404a.so and libpr2404b.a. (run_tests): Run pr2404.
-rw-r--r--ld/testsuite/ChangeLog11
-rw-r--r--ld/testsuite/ld-elf/pr2404.out4
-rw-r--r--ld/testsuite/ld-elf/pr2404a.c10
-rw-r--r--ld/testsuite/ld-elf/pr2404b.c21
-rw-r--r--ld/testsuite/ld-elf/shared.exp9
5 files changed, 55 insertions, 0 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 4cfe40d..84729b6 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,14 @@
+2014-01-20 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/2404
+ * ld-elf/pr2404.out: New file.
+ * ld-elf/pr2404a.c: Likewise.
+ * ld-elf/pr2404b.c: Likewise.
+
+ * ld-elf/shared.exp (build_tests): Build libpr2404a.so and
+ libpr2404b.a.
+ (run_tests): Run pr2404.
+
2014-01-20 Alan Modra <amodra@gmail.com>
* ld-scripts/pr14962-2.d,
diff --git a/ld/testsuite/ld-elf/pr2404.out b/ld/testsuite/ld-elf/pr2404.out
new file mode 100644
index 0000000..d1aa5fe
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr2404.out
@@ -0,0 +1,4 @@
+times: -1
+times: 20
+time: 0
+time: 10
diff --git a/ld/testsuite/ld-elf/pr2404a.c b/ld/testsuite/ld-elf/pr2404a.c
new file mode 100644
index 0000000..4b2b5a9
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr2404a.c
@@ -0,0 +1,10 @@
+#include <time.h>
+#include <sys/times.h>
+
+int
+bar (void)
+{
+ struct tms buf;
+ clock_t ticks = times (&buf);
+ return ticks == 0 && time (NULL) == 0;
+}
diff --git a/ld/testsuite/ld-elf/pr2404b.c b/ld/testsuite/ld-elf/pr2404b.c
new file mode 100644
index 0000000..5f0f7b4
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr2404b.c
@@ -0,0 +1,21 @@
+#include <stdio.h>
+
+extern int bar (void);
+
+int times = -1;
+int time;
+
+int
+main ()
+{
+ printf ("times: %d\n", times);
+ times = 20;
+ printf ("times: %d\n", times);
+
+ printf ("time: %d\n", time);
+ time = 10;
+ printf ("time: %d\n", time);
+ bar ();
+
+ return 0;
+}
diff --git a/ld/testsuite/ld-elf/shared.exp b/ld/testsuite/ld-elf/shared.exp
index 3162547..afc262c 100644
--- a/ld/testsuite/ld-elf/shared.exp
+++ b/ld/testsuite/ld-elf/shared.exp
@@ -218,6 +218,12 @@ set build_tests {
{"Build needed2"
"tmpdir/libneeded2c.o -Wl,--as-needed tmpdir/libneeded2a.so tmpdir/libneeded2b.so" ""
{dummy.c} {} "needed2"}
+ {"Build libpr2404a.so"
+ "-shared" "-fPIC"
+ {pr2404a.c} {} "libpr2404a.so"}
+ {"Build libpr2404b.a"
+ "" ""
+ {pr2404b.c} {} "libpr2404b.a"}
}
run_cc_link_tests $build_tests
@@ -365,6 +371,9 @@ set run_tests {
{"Run relmain"
"--no-as-needed -rpath=tmpdir -Ltmpdir -lrel" ""
{relmain.c} "relmain" "relmain.out"}
+ {"Run pr2404"
+ "tmpdir/pr2404b.o tmpdir/libpr2404a.so" ""
+ {dummy.c} "pr2404" "pr2404.out"}
}
# NetBSD ELF systems do not currently support the .*_array sections.