diff options
author | Alan Modra <amodra@gmail.com> | 2021-02-26 13:26:19 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2021-02-26 17:49:04 +1030 |
commit | bfece7562d62f11782ca7089310b4063be526fb2 (patch) | |
tree | fc34768138aecf626a76760461fe56b632b90a1f /ld/testsuite | |
parent | 8255cf421c513747b7e189f932ca6e5b450e0d46 (diff) | |
download | gdb-bfece7562d62f11782ca7089310b4063be526fb2.zip gdb-bfece7562d62f11782ca7089310b4063be526fb2.tar.gz gdb-bfece7562d62f11782ca7089310b4063be526fb2.tar.bz2 |
Add PR27441 testcase
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.
Diffstat (limited to 'ld/testsuite')
-rw-r--r-- | ld/testsuite/ld-plugin/lto.exp | 12 | ||||
-rw-r--r-- | ld/testsuite/ld-plugin/pr27441a.c | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-plugin/pr27441b.c | 1 | ||||
-rw-r--r-- | ld/testsuite/ld-plugin/pr27441c.c | 8 | ||||
-rw-r--r-- | ld/testsuite/ld-plugin/pr27441c.d | 4 |
5 files changed, 27 insertions, 0 deletions
diff --git a/ld/testsuite/ld-plugin/lto.exp b/ld/testsuite/ld-plugin/lto.exp index 38cea30..2271211 100644 --- a/ld/testsuite/ld-plugin/lto.exp +++ b/ld/testsuite/ld-plugin/lto.exp @@ -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 index 0000000..59034df --- /dev/null +++ b/ld/testsuite/ld-plugin/pr27441a.c @@ -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 index 0000000..9f2ed19 --- /dev/null +++ b/ld/testsuite/ld-plugin/pr27441b.c @@ -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 index 0000000..207a183 --- /dev/null +++ b/ld/testsuite/ld-plugin/pr27441c.c @@ -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 index 0000000..d0bea66 --- /dev/null +++ b/ld/testsuite/ld-plugin/pr27441c.d @@ -0,0 +1,4 @@ +#... + .* \(NEEDED\) +Shared library: \[tmpdir/pr27441b.so\] + .* \(NEEDED\) +Shared library: \[tmpdir/pr27441a.so\] +#pass |