Add PR27441 testcase
authorAlan Modra <amodra@gmail.com>
Fri, 26 Feb 2021 02:56:19 +0000 (13:26 +1030)
committerAlan Modra <amodra@gmail.com>
Fri, 26 Feb 2021 07:19:04 +0000 (17:49 +1030)
PR 27441
* testsuite/ld-plugin/pr27441a.c,
* testsuite/ld-plugin/pr27441b.c,
* testsuite/ld-plugin/pr27441c.c,
* testsuite/ld-plugin/pr27441c.d: New test.
* testsuite/ld-plugin/lto.exp: Run it.

ld/ChangeLog
ld/testsuite/ld-plugin/lto.exp
ld/testsuite/ld-plugin/pr27441a.c [new file with mode: 0644]
ld/testsuite/ld-plugin/pr27441b.c [new file with mode: 0644]
ld/testsuite/ld-plugin/pr27441c.c [new file with mode: 0644]
ld/testsuite/ld-plugin/pr27441c.d [new file with mode: 0644]

index a94be7526b4ac5ed3f4e2db686d098b729402d5c..6540407237c8f487105c786585d5240db86ed8be 100644 (file)
@@ -1,3 +1,12 @@
+2021-02-26  Alan Modra  <amodra@gmail.com>
+
+       PR 27441
+       * testsuite/ld-plugin/pr27441a.c,
+       * testsuite/ld-plugin/pr27441b.c,
+       * testsuite/ld-plugin/pr27441c.c,
+       * testsuite/ld-plugin/pr27441c.d: New test.
+       * testsuite/ld-plugin/lto.exp: Run it.
+
 2021-02-25  Jan Beulich  <jbeulich@suse.com>
 
        * ld.texi (PROVIDE): Downgrade "error" to "diagnostic".
index 38cea30aed41e23fc00cd563e6823e2890b4ff91..2271211367b919b6e15f1cfab6096fd96a52d25b 100644 (file)
@@ -448,6 +448,18 @@ set lto_link_elf_tests [list \
   [list {pr27311-2} \
    {tmpdir/pr27311d.o -Wl,--no-as-needed,--rpath-link=. tmpdir/pr27311b.so} {} \
    {dummy.c} {{readelf {--dyn-syms --wide} pr27311.d}} {pr27311-2}] \
+  [list {pr27441a.so} \
+   {-shared} {-fPIC} \
+   {pr27441a.c} {} {pr27441a.so}] \
+  [list {pr27441b.so} \
+   {-shared} {-fPIC} \
+   {pr27441b.c} {} {pr27441b.so}] \
+  [list {pr27441c.o} \
+   {} {-fPIC -flto} \
+   {pr27441c.c} {} {}] \
+  [list {pr27441c.so} \
+   {-shared -fPIC -Wl,--as-needed tmpdir/pr27441c.o tmpdir/pr27441b.so tmpdir/pr27441a.so} {-fPIC} \
+   {dummy.c} {{readelf {-dW} pr27441c.d}} {pr27441c.so}] \
 ]
 
 # PR 14918 checks that libgcc is not spuriously included in a shared link of
diff --git a/ld/testsuite/ld-plugin/pr27441a.c b/ld/testsuite/ld-plugin/pr27441a.c
new file mode 100644 (file)
index 0000000..59034df
--- /dev/null
@@ -0,0 +1,2 @@
+int func1 (void) { return 1; }
+int func2 (void) { return 2; }
diff --git a/ld/testsuite/ld-plugin/pr27441b.c b/ld/testsuite/ld-plugin/pr27441b.c
new file mode 100644 (file)
index 0000000..9f2ed19
--- /dev/null
@@ -0,0 +1 @@
+int __attribute__((weak)) func1 (void) { return 3; }
diff --git a/ld/testsuite/ld-plugin/pr27441c.c b/ld/testsuite/ld-plugin/pr27441c.c
new file mode 100644 (file)
index 0000000..207a183
--- /dev/null
@@ -0,0 +1,8 @@
+extern int func1 (void);
+extern int func2 (void);
+
+int
+callthem (void)
+{
+  return func1 () + func2 ();
+}
diff --git a/ld/testsuite/ld-plugin/pr27441c.d b/ld/testsuite/ld-plugin/pr27441c.d
new file mode 100644 (file)
index 0000000..d0bea66
--- /dev/null
@@ -0,0 +1,4 @@
+#...
+ .* \(NEEDED\) +Shared library: \[tmpdir/pr27441b.so\]
+ .* \(NEEDED\) +Shared library: \[tmpdir/pr27441a.so\]
+#pass
This page took 0.026217 seconds and 4 git commands to generate.