Add tests for PR ld/16452 and PR ld/16457
authorH.J. Lu <hjl.tools@gmail.com>
Mon, 1 Dec 2014 14:06:21 +0000 (06:06 -0800)
committerH.J. Lu <hjl.tools@gmail.com>
Mon, 1 Dec 2014 14:16:00 +0000 (06:16 -0800)
PR ld/16452
PR ld/16457
* ld-elf/pr16452.map: New file.
* ld-elf/pr16452.od: Likewise.
* ld-elf/pr16452a.c: Likewise.
* ld-elf/pr16452b.c: Likewise.
* ld-elf/pr16457.od: Likewise.

* ld-elf/shared.exp (build_tests): Add tests for PR ld/16452 and
PR ld/16457.

ld/testsuite/ChangeLog
ld/testsuite/ld-elf/pr16452.map [new file with mode: 0644]
ld/testsuite/ld-elf/pr16452.od [new file with mode: 0644]
ld/testsuite/ld-elf/pr16452a.c [new file with mode: 0644]
ld/testsuite/ld-elf/pr16452b.c [new file with mode: 0644]
ld/testsuite/ld-elf/pr16457.od [new file with mode: 0644]
ld/testsuite/ld-elf/shared.exp

index e09af2b..881f5ce 100644 (file)
@@ -1,3 +1,16 @@
+2014-12-01  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR ld/16452
+       PR ld/16457
+       * ld-elf/pr16452.map: New file.
+       * ld-elf/pr16452.od: Likewise.
+       * ld-elf/pr16452a.c: Likewise.
+       * ld-elf/pr16452b.c: Likewise.
+       * ld-elf/pr16457.od: Likewise.
+
+       * ld-elf/shared.exp (build_tests): Add tests for PR ld/16452 and
+       PR ld/16457.
+
 2014-11-18  H.J. Lu  <hongjiu.lu@intel.com>
 
        * ld-x86-64/mpx.exp: Always run mpx3 and mpx4 tests in 64-bit.
diff --git a/ld/testsuite/ld-elf/pr16452.map b/ld/testsuite/ld-elf/pr16452.map
new file mode 100644 (file)
index 0000000..6262600
--- /dev/null
@@ -0,0 +1 @@
+FOO{global:f;};
diff --git a/ld/testsuite/ld-elf/pr16452.od b/ld/testsuite/ld-elf/pr16452.od
new file mode 100644 (file)
index 0000000..297f867
--- /dev/null
@@ -0,0 +1,7 @@
+#failif
+#...
+Version References:
+#...
+  required from libpr16452a.so:
+    0x[0-9a-f]+ 0x00 .. FOO
+#...
diff --git a/ld/testsuite/ld-elf/pr16452a.c b/ld/testsuite/ld-elf/pr16452a.c
new file mode 100644 (file)
index 0000000..c9b1784
--- /dev/null
@@ -0,0 +1 @@
+int f(void){return 0;}
diff --git a/ld/testsuite/ld-elf/pr16452b.c b/ld/testsuite/ld-elf/pr16452b.c
new file mode 100644 (file)
index 0000000..9ed2149
--- /dev/null
@@ -0,0 +1,2 @@
+int f(void) __attribute__((weak));
+int main(void){return f?f():0;}
diff --git a/ld/testsuite/ld-elf/pr16457.od b/ld/testsuite/ld-elf/pr16457.od
new file mode 100644 (file)
index 0000000..b29c4a1
--- /dev/null
@@ -0,0 +1,6 @@
+#failif
+#...
+Dynamic Section:
+#...
+[ ]+NEEDED[ ]+libpr16452a.so
+#...
index b55856a..219e721 100644 (file)
@@ -246,6 +246,18 @@ set build_tests {
   {"Build dynamic-1"
    "-Wl,--dynamic-list,dynamic-1.syms -Wl,--gc-sections" "-ffunction-sections"
    {dynamic-1.c} {{readelf {-s} dynamic-1.rd}} "dynamic-1"}
+  {"Build libpr16452a.so"
+   "-shared -Wl,-soname,libpr16452a.so,--version-script=pr16452.map" "-fPIC"
+   {pr16452a.c} {} "libpr16452a.so"}
+  {"Build libpr16452b.so"
+   "-shared -Wl,-soname,libpr16452b.so,--no-as-needed tmpdir/libpr16452a.so" "-fPIC"
+   {dummy.c} {} "libpr16452b.so"}
+  {"Build pr16452"
+   "tmpdir/libpr16452b.so -Wl,-rpath=tmpdir" ""
+   {pr16452b.c} {{objdump {-p} pr16452.od}} "pr16452"}
+  {"Build pr16457"
+   "tmpdir/libpr16452b.so -Wl,-rpath=tmpdir" ""
+   {pr16452b.c} {{objdump {-p} pr16457.od}} "pr16457"}
 }
 
 run_cc_link_tests $build_tests