ld: Add PR ld/25593 tests
authorH.J. Lu <hjl.tools@gmail.com>
Wed, 26 Feb 2020 11:56:28 +0000 (03:56 -0800)
committerH.J. Lu <hjl.tools@gmail.com>
Wed, 26 Feb 2020 11:58:47 +0000 (03:58 -0800)
PR ld/25593
* testsuite/ld-plugin/lto.exp: Run PR ld/25593 tests.
* testsuite/ld-plugin/pr25593.d: New file.
* testsuite/ld-plugin/pr25593a-1.c: Likewise.
* testsuite/ld-plugin/pr25593a-2.c: Likewise.
* testsuite/ld-plugin/pr25593b.c: Likewise.
* testsuite/ld-plugin/pr25593c.c: Likewise.
* testsuite/ld-plugin/pr25593d.c: Likewise.
* testsuite/ld-plugin/pr25593e.c: Likewise.

ld/ChangeLog
ld/testsuite/ld-plugin/lto.exp
ld/testsuite/ld-plugin/pr25593.d [new file with mode: 0644]
ld/testsuite/ld-plugin/pr25593a-1.c [new file with mode: 0644]
ld/testsuite/ld-plugin/pr25593a-2.c [new file with mode: 0644]
ld/testsuite/ld-plugin/pr25593b.c [new file with mode: 0644]
ld/testsuite/ld-plugin/pr25593c.c [new file with mode: 0644]
ld/testsuite/ld-plugin/pr25593d.c [new file with mode: 0644]
ld/testsuite/ld-plugin/pr25593e.c [new file with mode: 0644]

index 9333dffbdf6d77383dd872f735fe58974d3f3e6e..56e84c13d27c04893b45c03b11eb4c46e38cae64 100644 (file)
@@ -1,3 +1,15 @@
+2020-02-26  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR ld/25593
+       * testsuite/ld-plugin/lto.exp: Run PR ld/25593 tests.
+       * testsuite/ld-plugin/pr25593.d: New file.
+       * testsuite/ld-plugin/pr25593a-1.c: Likewise.
+       * testsuite/ld-plugin/pr25593a-2.c: Likewise.
+       * testsuite/ld-plugin/pr25593b.c: Likewise.
+       * testsuite/ld-plugin/pr25593c.c: Likewise.
+       * testsuite/ld-plugin/pr25593d.c: Likewise.
+       * testsuite/ld-plugin/pr25593e.c: Likewise.
+
 2020-02-26  Alan Modra  <amodra@gmail.com>
 
        * emultempl/cskyelf.em: Indent labels correctly.
index 1b44b0da3fda900518255a18cf9f2a57e8f07841..0243f093288115d1e7fcd4b6e94b590e4d9c2be7 100644 (file)
@@ -342,6 +342,32 @@ set lto_link_elf_tests [list \
   [list "PR ld/24486" \
    "-O2 -flto tmpdir/pr24486a.o tmpdir/pr24486c.so -Wl,--as-needed tmpdir/pr24486b.so" "" \
    {dummy.c} {} "pr24486.exe"] \
+  [list "Build pr25593a-1.o" \
+   "$plug_opt" "-flto -O2" \
+   {pr25593a-1.c} {} "" "c"] \
+  [list "Build pr25593a-2.o" \
+   "" "-O2" \
+   {pr25593a-2.c} {} "" "c"] \
+  [list "Build pr25593b.o" \
+   "" "-O2" \
+   {pr25593b.c} {} "" "c"] \
+  [list "Build pr25593c.so" \
+   "-shared" "-O2 -fpic" \
+   {pr25593c.c} {} "pr25593c.so" "c"] \
+  [list "Build pr25593d.so" \
+   "-shared" "-O2 -fpic" \
+   {pr25593d.c} {} "pr25593d.so" "c"] \
+  [list "Build pr25593e.so" \
+   "-shared" "-O2 -fpic" \
+   {pr25593e.c} {} "pr25593e.so" "c"] \
+  [list "PR ld/r25593 (LTO)" \
+   "-O2 -flto -Wl,--as-needed tmpdir/pr25593a-1.o tmpdir/pr25593b.o \
+    tmpdir/pr25593c.so tmpdir/pr25593d.so tmpdir/pr25593e.so" "" \
+   {dummy.c} {{readelf {-d --wide} pr25593.d}} "pr25593a.exe"] \
+  [list "PR ld/r25593" \
+   "-O2 -flto -Wl,--as-needed tmpdir/pr25593a-2.o tmpdir/pr25593b.o \
+    tmpdir/pr25593c.so tmpdir/pr25593d.so tmpdir/pr25593e.so" "" \
+   {dummy.c} {{readelf {-d --wide} pr25593.d}} "pr25593b.exe"] \
 ]
 
 # PR 14918 checks that libgcc is not spuriously included in a shared link of
diff --git a/ld/testsuite/ld-plugin/pr25593.d b/ld/testsuite/ld-plugin/pr25593.d
new file mode 100644 (file)
index 0000000..7787767
--- /dev/null
@@ -0,0 +1,5 @@
+#...
+ 0x0+1 \(NEEDED\) +Shared library: \[tmpdir/pr25593c\.so\]
+ 0x0+1 \(NEEDED\) +Shared library: \[tmpdir/pr25593d\.so\]
+ 0x0+1 \(NEEDED\) +Shared library: \[tmpdir/pr25593e\.so\]
+#pass
diff --git a/ld/testsuite/ld-plugin/pr25593a-1.c b/ld/testsuite/ld-plugin/pr25593a-1.c
new file mode 100644 (file)
index 0000000..13d5395
--- /dev/null
@@ -0,0 +1,12 @@
+extern void foo (void);
+extern void bar (void);
+extern void xxx (void);
+
+int
+main (void)
+{
+  xxx ();
+  foo ();
+  bar ();
+  return 0;
+}
diff --git a/ld/testsuite/ld-plugin/pr25593a-2.c b/ld/testsuite/ld-plugin/pr25593a-2.c
new file mode 100644 (file)
index 0000000..bdc30dd
--- /dev/null
@@ -0,0 +1 @@
+#include "pr25593a-1.c"
diff --git a/ld/testsuite/ld-plugin/pr25593b.c b/ld/testsuite/ld-plugin/pr25593b.c
new file mode 100644 (file)
index 0000000..75b2419
--- /dev/null
@@ -0,0 +1,7 @@
+extern void xyz ();
+
+void
+xxx (void)
+{
+  xyz ();
+}
diff --git a/ld/testsuite/ld-plugin/pr25593c.c b/ld/testsuite/ld-plugin/pr25593c.c
new file mode 100644 (file)
index 0000000..cd0130c
--- /dev/null
@@ -0,0 +1,4 @@
+void
+foo (void)
+{
+}
diff --git a/ld/testsuite/ld-plugin/pr25593d.c b/ld/testsuite/ld-plugin/pr25593d.c
new file mode 100644 (file)
index 0000000..7de81b3
--- /dev/null
@@ -0,0 +1,4 @@
+void
+bar (void)
+{
+}
diff --git a/ld/testsuite/ld-plugin/pr25593e.c b/ld/testsuite/ld-plugin/pr25593e.c
new file mode 100644 (file)
index 0000000..831b105
--- /dev/null
@@ -0,0 +1,4 @@
+void
+xyz (void)
+{
+}