Skip to content

Commit 3592ada

Browse files
committed
ld: Restore PR ld/15146 tests
commit 7d409ac Author: Alan Modra <amodra@gmail.com> Date: Thu Feb 4 13:56:34 2021 +1030 PR27311, (symbol from plugin): undefined reference, hidden sym fixed PR ld/15146. Restore PR ld/15146 tests. PR ld/15146 * testsuite/ld-plugin/lto.exp: Run PR ld/15146 tests. * testsuite/ld-plugin/pr15146.d: Restored. * testsuite/ld-plugin/pr15146a.c: Likewise. * testsuite/ld-plugin/pr15146b.c: Likewise. * testsuite/ld-plugin/pr15146c.c: Likewise. * testsuite/ld-plugin/pr15146d.c: Likewise. (cherry picked from commit 37707bd)
1 parent b71c7a5 commit 3592ada

File tree

7 files changed

+57
-0
lines changed

7 files changed

+57
-0
lines changed

ld/ChangeLog

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
2021-02-04 H.J. Lu <hongjiu.lu@intel.com>
2+
3+
PR ld/15146
4+
* testsuite/ld-plugin/lto.exp: Run PR ld/15146 tests.
5+
* testsuite/ld-plugin/pr15146.d: Restored.
6+
* testsuite/ld-plugin/pr15146a.c: Likewise.
7+
* testsuite/ld-plugin/pr15146b.c: Likewise.
8+
* testsuite/ld-plugin/pr15146c.c: Likewise.
9+
* testsuite/ld-plugin/pr15146d.c: Likewise.
10+
111
2021-02-04 Alan Modra <amodra@gmail.com>
212

313
* testsuite/ld-plugin/pr27311d.c: New test.

ld/testsuite/ld-plugin/lto.exp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,21 @@ set lto_link_elf_tests [list \
304304
[list "PR ld/13244" \
305305
"-shared -O2 -fPIC -flto -fuse-linker-plugin -nostdlib" "-O2 -fno-early-inlining -flto" \
306306
{pr13244.c} {{"readelf" {-s --wide} "pr13244.d"}} "pr13244.so" "c"] \
307+
[list "Build libpr15146a.a" \
308+
"$plug_opt" "-flto -O2" \
309+
{pr15146a.c} {} "lib15146a.a"] \
310+
[list "Build pr15146b.so" \
311+
"-shared" "-O2 -fpic" \
312+
{pr15146b.c} {} "pr15146b.so" "c"] \
313+
[list "Build pr15146c.so" \
314+
"-shared -Wl,--no-as-needed tmpdir/pr15146b.so" "-O2 -fpic $no_lto" \
315+
{pr15146c.c} {} "pr15146c.so" "c"] \
316+
[list "PR ld/15146 (1)" \
317+
"-O2 -flto -fuse-linker-plugin -Wl,-rpath-link,. -Wl,--no-copy-dt-needed-entries -Wl,--no-as-needed tmpdir/pr15146a.o tmpdir/pr15146c.so" "" \
318+
{dummy.c} {{"readelf" {-d} "pr15146.d"}} "pr15146a.exe"] \
319+
[list "Build libpr15146d.a" \
320+
"$plug_opt" "-flto -O2" \
321+
{pr15146d.c} {} "lib15146d.a"] \
307322
[list "Build libpr16746a.a" \
308323
"" "" \
309324
{pr16746a.c pr16746b.c} {} "lib15146a.a"] \
@@ -637,6 +652,13 @@ run_cc_link_tests $lto_compile_elf_tests
637652
# Restrict these to ELF targets that support shared libs and PIC.
638653
if { [is_elf_format] && [check_lto_shared_available] } {
639654
run_cc_link_tests $lto_link_elf_tests
655+
set testname "PR ld/15146 (2)"
656+
set exec_output [run_host_cmd "$CC" "-O2 -flto -fuse-linker-plugin -Wl,-rpath-link,. -Wl,--no-copy-dt-needed-entries -Wl,--no-as-needed tmpdir/pr15146d.o tmpdir/pr15146c.so"]
657+
if { [ regexp "undefined reference to symbol '\\.?xxx'" $exec_output ] } {
658+
pass $testname
659+
} {
660+
fail $testname
661+
}
640662
set testname "PR ld/16746 (3)"
641663
set exec_output [run_host_cmd "$CC" "-O2 -flto -fuse-linker-plugin tmpdir/pr16746b.o tmpdir/pr16746d.o"]
642664
if { [ regexp "warning: \\.?foobar" $exec_output ] && ![ regexp "symbol from plugin" $exec_output ] } {

ld/testsuite/ld-plugin/pr15146.d

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#failif
2+
#...
3+
+0x[0-9a-f]+ +\(NEEDED\) +Shared library: +\[.*pr15146b.so\]
4+
#...

ld/testsuite/ld-plugin/pr15146a.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
extern int xxx;
2+
3+
int
4+
bar (void)
5+
{
6+
return xxx;
7+
}
8+
9+
int
10+
main ()
11+
{
12+
return 0;
13+
}

ld/testsuite/ld-plugin/pr15146b.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
int xxx = 3;

ld/testsuite/ld-plugin/pr15146c.c

Whitespace-only changes.

ld/testsuite/ld-plugin/pr15146d.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
extern int xxx;
2+
3+
int
4+
main ()
5+
{
6+
return xxx;
7+
}

0 commit comments

Comments
 (0)