aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-plugin
diff options
context:
space:
mode:
Diffstat (limited to 'ld/testsuite/ld-plugin')
-rw-r--r--ld/testsuite/ld-plugin/lto-20.ver1
-rw-r--r--ld/testsuite/ld-plugin/lto-20a.c2
-rw-r--r--ld/testsuite/ld-plugin/lto-20b.c11
-rw-r--r--ld/testsuite/ld-plugin/lto.exp42
-rw-r--r--ld/testsuite/ld-plugin/pr32846a.c6
-rw-r--r--ld/testsuite/ld-plugin/pr32846b.c4
-rw-r--r--ld/testsuite/ld-plugin/pr32846c.c6
-rw-r--r--ld/testsuite/ld-plugin/pr32846d.c12
-rw-r--r--ld/testsuite/ld-plugin/pr32846e.c4
9 files changed, 88 insertions, 0 deletions
diff --git a/ld/testsuite/ld-plugin/lto-20.ver b/ld/testsuite/ld-plugin/lto-20.ver
new file mode 100644
index 0000000..ac906ac
--- /dev/null
+++ b/ld/testsuite/ld-plugin/lto-20.ver
@@ -0,0 +1 @@
+FOO { global: foo; };
diff --git a/ld/testsuite/ld-plugin/lto-20a.c b/ld/testsuite/ld-plugin/lto-20a.c
new file mode 100644
index 0000000..3d6dac9
--- /dev/null
+++ b/ld/testsuite/ld-plugin/lto-20a.c
@@ -0,0 +1,2 @@
+extern int foo ();
+int main () { return foo (); }
diff --git a/ld/testsuite/ld-plugin/lto-20b.c b/ld/testsuite/ld-plugin/lto-20b.c
new file mode 100644
index 0000000..ba123cb
--- /dev/null
+++ b/ld/testsuite/ld-plugin/lto-20b.c
@@ -0,0 +1,11 @@
+extern int printf (const char *, ...);
+int foo ()
+{
+#ifdef SHARED
+ printf ("PASS\n");
+ return 0;
+#else
+ printf ("FAIL\n");
+ return 1;
+#endif
+}
diff --git a/ld/testsuite/ld-plugin/lto.exp b/ld/testsuite/ld-plugin/lto.exp
index 556bbe9..3a56fb5 100644
--- a/ld/testsuite/ld-plugin/lto.exp
+++ b/ld/testsuite/ld-plugin/lto.exp
@@ -477,6 +477,12 @@ set lto_link_elf_tests [list \
[list {liblto-19.so} \
{-shared tmpdir/lto-19b.o tmpdir/liblto-19.a} {-O2 -fPIC} \
{dummy.c} {} {liblto-19.so}] \
+ [list {liblto-20_static.a} \
+ {} {-fPIC} \
+ {lto-20b.c} {} {liblto-20_static.a}] \
+ [list {liblto-20.so} \
+ {-shared -Wl,--version-script=lto-20.ver} {-DSHARED -fPIC} \
+ {lto-20b.c} {} {liblto-20.so}] \
[list {pr26806.so} \
{-shared} {-fpic -O2 -flto} \
{pr26806.c} {{nm {-D} pr26806.d}} {pr26806.so}] \
@@ -880,6 +886,10 @@ set lto_run_elf_shared_tests [list \
{-Wl,--as-needed,-R,tmpdir} {} \
{lto-19c.c} {lto-19.exe} {pass.out} {-flto -O2} {c} {} \
{tmpdir/liblto-19.so tmpdir/liblto-19.a}] \
+ [list {lto-20} \
+ {-Wl,--as-needed,-R,tmpdir} {} \
+ {lto-20a.c} {lto-20.exe} {pass.out} {-flto} {c} {} \
+ {tmpdir/liblto-20.so tmpdir/liblto-20_static.a -Wl,--no-as-needed}] \
[list {pr31482a} \
{-Wl,--no-as-needed,-R,tmpdir} {} \
{pr31482a.c} {pr31482a.exe} {pass.out} {-flto} {c} {} \
@@ -1202,6 +1212,38 @@ if { [is_elf_format] } {
if { [is_elf_format] && [check_lto_shared_available] } {
run_ld_link_exec_tests $lto_run_elf_shared_tests
+ if { [check_lto_fat_available] } {
+ run_cc_link_tests [list \
+ [list \
+ "Build libpr32846a.a" \
+ "$plug_opt" "-fPIC -O2 -flto $lto_no_fat" \
+ {pr32846a.c pr32846b.c} {} "libpr32846a.a" \
+ ] \
+ [list \
+ "Build libpr32846b.a" \
+ "$plug_opt" "-fPIC -O2 -flto $lto_no_fat" \
+ {pr32846a.c pr32846b.c pr32846c.c} {} "libpr32846b.a" \
+ ] \
+ [list \
+ "Build pr32846d.o" \
+ "$plug_opt" "-fPIC -O2 -flto $lto_no_fat" \
+ {pr32846d.c} {} \
+ ] \
+ [list \
+ "Build pr32846e.o" \
+ "$plug_opt" "-fPIC -O2 -flto $lto_no_fat" \
+ {pr32846e.c} {} \
+ ] \
+ [list \
+ "Build pr32846" \
+ "-shared -fPIC -O2 -flto $lto_no_fat -Wl,--no-undefined \
+ tmpdir/pr32846d.o tmpdir/libpr32846a.a \
+ tmpdir/libpr32846b.a tmpdir/pr32846e.o" \
+ "-O2 -fPIC -flto $lto_no_fat" \
+ {dummy.c} {} "pr32846" \
+ ] \
+ ] \
+ }
}
proc pr20103 {cflags libs} {
diff --git a/ld/testsuite/ld-plugin/pr32846a.c b/ld/testsuite/ld-plugin/pr32846a.c
new file mode 100644
index 0000000..8c16171
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr32846a.c
@@ -0,0 +1,6 @@
+extern void mkdir_p (void);
+void
+mkdir_parents (void)
+{
+ mkdir_p ();
+}
diff --git a/ld/testsuite/ld-plugin/pr32846b.c b/ld/testsuite/ld-plugin/pr32846b.c
new file mode 100644
index 0000000..9776a37
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr32846b.c
@@ -0,0 +1,4 @@
+void
+hash_new (void)
+{
+}
diff --git a/ld/testsuite/ld-plugin/pr32846c.c b/ld/testsuite/ld-plugin/pr32846c.c
new file mode 100644
index 0000000..f87cffb
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr32846c.c
@@ -0,0 +1,6 @@
+extern void hash_new (void);
+void
+kmod_new (void)
+{
+ hash_new();
+}
diff --git a/ld/testsuite/ld-plugin/pr32846d.c b/ld/testsuite/ld-plugin/pr32846d.c
new file mode 100644
index 0000000..c6f4102
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr32846d.c
@@ -0,0 +1,12 @@
+extern void kmod_new (void);
+extern void mkdir_parents (void);
+void
+do_lsmod (void)
+{
+ kmod_new ();
+}
+void
+do_static_nodes (void)
+{
+ mkdir_parents();
+}
diff --git a/ld/testsuite/ld-plugin/pr32846e.c b/ld/testsuite/ld-plugin/pr32846e.c
new file mode 100644
index 0000000..c4e5e56
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr32846e.c
@@ -0,0 +1,4 @@
+void
+mkdir_p (void)
+{
+}