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.exp12
-rw-r--r--ld/testsuite/ld-plugin/pr24406-1.c17
-rw-r--r--ld/testsuite/ld-plugin/pr24406-2a.c17
-rw-r--r--ld/testsuite/ld-plugin/pr24406-2b.c4
4 files changed, 50 insertions, 0 deletions
diff --git a/ld/testsuite/ld-plugin/lto.exp b/ld/testsuite/ld-plugin/lto.exp
index 3449a07..b13a773 100644
--- a/ld/testsuite/ld-plugin/lto.exp
+++ b/ld/testsuite/ld-plugin/lto.exp
@@ -231,6 +231,9 @@ set lto_link_tests [list \
{pr23958.c} \
"" \
"libpr23958.so"] \
+ [list "Build pr24406-2b.o" \
+ "" "-O2 -fno-lto" \
+ {pr24406-2b.c}] \
]
if { [at_least_gcc_version 4 7] } {
@@ -434,6 +437,15 @@ set lto_run_tests [list \
"-O2 -flto" "" \
{dummy.c} "pr22751" "pass.out" "-flto -O2" "c" "" \
"-Wl,--whole-archive tmpdir/pr22751.a -Wl,--no-whole-archive"] \
+ [list "Run pr24406-1" \
+ "-O2 -flto" "" \
+ {pr24406-1.c} "pr24406-1" "pass.out" "-flto -O2" "c" "" \
+ "-Wl,--wrap=read"] \
+ [list "Run pr24406-2" \
+ "-O2 -flto" "" \
+ {pr24406-2a.c} "pr24406-2" "pass.out" \
+ "-flto -O2" "c" "" \
+ "tmpdir/pr24406-2b.o -Wl,--wrap=cook"] \
]
if { [at_least_gcc_version 4 7] } {
diff --git a/ld/testsuite/ld-plugin/pr24406-1.c b/ld/testsuite/ld-plugin/pr24406-1.c
new file mode 100644
index 0000000..43995bd
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr24406-1.c
@@ -0,0 +1,17 @@
+#include <stdio.h>
+#include <unistd.h>
+
+ssize_t
+__wrap_read (int fd, void *buffer, size_t count)
+{
+ puts ("PASS");
+ return fd + count + sizeof (buffer);
+}
+
+
+int
+main ()
+{
+ int i = read (1, "abc", 5);
+ return i == 0;
+}
diff --git a/ld/testsuite/ld-plugin/pr24406-2a.c b/ld/testsuite/ld-plugin/pr24406-2a.c
new file mode 100644
index 0000000..14f54ba
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr24406-2a.c
@@ -0,0 +1,17 @@
+#include <stdio.h>
+
+extern int cook(void);
+
+int __wrap_cook(void)
+{
+ puts ("PASS");
+ return 0;
+}
+
+int main()
+{
+ if (cook () == -1)
+ __builtin_abort ();
+
+ return 0;
+}
diff --git a/ld/testsuite/ld-plugin/pr24406-2b.c b/ld/testsuite/ld-plugin/pr24406-2b.c
new file mode 100644
index 0000000..bfb69df
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr24406-2b.c
@@ -0,0 +1,4 @@
+int cook(void)
+{
+ return -1;
+}