aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'ld/testsuite')
-rw-r--r--ld/testsuite/ld-plugin/lto.exp12
-rw-r--r--ld/testsuite/ld-plugin/pr22220.h8
-rw-r--r--ld/testsuite/ld-plugin/pr22220lib.cc6
-rw-r--r--ld/testsuite/ld-plugin/pr22220lib.ver1
-rw-r--r--ld/testsuite/ld-plugin/pr22220main.cc12
5 files changed, 39 insertions, 0 deletions
diff --git a/ld/testsuite/ld-plugin/lto.exp b/ld/testsuite/ld-plugin/lto.exp
index f0bc345..6b7ad53 100644
--- a/ld/testsuite/ld-plugin/lto.exp
+++ b/ld/testsuite/ld-plugin/lto.exp
@@ -295,6 +295,12 @@ set lto_link_elf_tests [list \
[list "Build pr21382.so" \
"-shared" "-O2 -fpic" \
{pr21382b.c} {} "pr21382.so" "c"] \
+ [list {Build pr22220lib.so} \
+ {-shared -Wl,--version-script=pr22220lib.ver} {-fPIC} \
+ {pr22220lib.cc} {} {pr22220lib.so} {c++}] \
+ [list {Build pr22220main.o} \
+ {} {-flto} \
+ {pr22220main.cc} {} {} {c++}] \
]
# Check final symbols in executables.
@@ -396,6 +402,12 @@ set lto_run_elf_shared_tests [list \
[list "Run pr21382" \
"-O2 -flto -fuse-linker-plugin -Wl,--as-needed tmpdir/pr21382a.o tmpdir/pr21382.so" "" \
{dummy.c} "pr21382.exe" "pass.out" "" "c"] \
+ [list {pr22220a} \
+ {-flto -fuse-linker-plugin tmpdir/pr22220main.o tmpdir/pr22220lib.so} {} \
+ {dummy.c} {pr22220a.exe} {pass.out} {} {c++}] \
+ [list {pr22220b} \
+ {-flto -fuse-linker-plugin -Wl,--no-as-needed tmpdir/pr22220lib.so tmpdir/pr22220main.o} {} \
+ {dummy.c} {pr22220b.exe} {pass.out} {} {c++}] \
]
# LTO run-time tests for ELF
diff --git a/ld/testsuite/ld-plugin/pr22220.h b/ld/testsuite/ld-plugin/pr22220.h
new file mode 100644
index 0000000..b15b45c
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr22220.h
@@ -0,0 +1,8 @@
+extern int doo();
+
+inline int *goo() {
+ static int xyz;
+ return &xyz;
+}
+
+int *boo();
diff --git a/ld/testsuite/ld-plugin/pr22220lib.cc b/ld/testsuite/ld-plugin/pr22220lib.cc
new file mode 100644
index 0000000..771f44f
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr22220lib.cc
@@ -0,0 +1,6 @@
+#include "pr22220.h"
+
+int* boo()
+{
+ return goo ();
+}
diff --git a/ld/testsuite/ld-plugin/pr22220lib.ver b/ld/testsuite/ld-plugin/pr22220lib.ver
new file mode 100644
index 0000000..6da7e1a
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr22220lib.ver
@@ -0,0 +1 @@
+BAR { global: *; };
diff --git a/ld/testsuite/ld-plugin/pr22220main.cc b/ld/testsuite/ld-plugin/pr22220main.cc
new file mode 100644
index 0000000..38c206f
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr22220main.cc
@@ -0,0 +1,12 @@
+#include <stdio.h>
+#include "pr22220.h"
+
+int main()
+{
+ if (boo() == goo())
+ {
+ printf ("PASS\n");
+ return 0;
+ }
+ return 1;
+}