diff options
author | 2021-02-04 05:11:37 -0800 | |
---|---|---|
committer | 2021-02-04 05:18:40 -0800 | |
commit | 3592ada38da455903b1ad2425c2c64849c4637fe (patch) | |
tree | 6dbf5ff224754578e68f47cded3df79449359bcc | |
parent | PR27311, (symbol from plugin): undefined reference, hidden sym (diff) | |
download | binutils-gdb-3592ada38da455903b1ad2425c2c64849c4637fe.tar.gz binutils-gdb-3592ada38da455903b1ad2425c2c64849c4637fe.tar.bz2 binutils-gdb-3592ada38da455903b1ad2425c2c64849c4637fe.zip |
ld: Restore PR ld/15146 tests
commit 7d409ac001cce916661d345bff01ed589991e762
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 37707bd8221c2e3f7676de8bee0c42ce3ab38c77)
-rw-r--r-- | ld/ChangeLog | 10 | ||||
-rw-r--r-- | ld/testsuite/ld-plugin/lto.exp | 22 | ||||
-rw-r--r-- | ld/testsuite/ld-plugin/pr15146.d | 4 | ||||
-rw-r--r-- | ld/testsuite/ld-plugin/pr15146a.c | 13 | ||||
-rw-r--r-- | ld/testsuite/ld-plugin/pr15146b.c | 1 | ||||
-rw-r--r-- | ld/testsuite/ld-plugin/pr15146c.c | 0 | ||||
-rw-r--r-- | ld/testsuite/ld-plugin/pr15146d.c | 7 |
7 files changed, 57 insertions, 0 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog index c299fb15867..b419b4a9788 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,13 @@ +2021-02-04 H.J. Lu <hongjiu.lu@intel.com> + + 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. + 2021-02-04 Alan Modra <amodra@gmail.com> * testsuite/ld-plugin/pr27311d.c: New test. diff --git a/ld/testsuite/ld-plugin/lto.exp b/ld/testsuite/ld-plugin/lto.exp index 3a59e37bc92..ec339ee1495 100644 --- a/ld/testsuite/ld-plugin/lto.exp +++ b/ld/testsuite/ld-plugin/lto.exp @@ -304,6 +304,21 @@ set lto_link_elf_tests [list \ [list "PR ld/13244" \ "-shared -O2 -fPIC -flto -fuse-linker-plugin -nostdlib" "-O2 -fno-early-inlining -flto" \ {pr13244.c} {{"readelf" {-s --wide} "pr13244.d"}} "pr13244.so" "c"] \ + [list "Build libpr15146a.a" \ + "$plug_opt" "-flto -O2" \ + {pr15146a.c} {} "lib15146a.a"] \ + [list "Build pr15146b.so" \ + "-shared" "-O2 -fpic" \ + {pr15146b.c} {} "pr15146b.so" "c"] \ + [list "Build pr15146c.so" \ + "-shared -Wl,--no-as-needed tmpdir/pr15146b.so" "-O2 -fpic $no_lto" \ + {pr15146c.c} {} "pr15146c.so" "c"] \ + [list "PR ld/15146 (1)" \ + "-O2 -flto -fuse-linker-plugin -Wl,-rpath-link,. -Wl,--no-copy-dt-needed-entries -Wl,--no-as-needed tmpdir/pr15146a.o tmpdir/pr15146c.so" "" \ + {dummy.c} {{"readelf" {-d} "pr15146.d"}} "pr15146a.exe"] \ + [list "Build libpr15146d.a" \ + "$plug_opt" "-flto -O2" \ + {pr15146d.c} {} "lib15146d.a"] \ [list "Build libpr16746a.a" \ "" "" \ {pr16746a.c pr16746b.c} {} "lib15146a.a"] \ @@ -637,6 +652,13 @@ run_cc_link_tests $lto_compile_elf_tests # Restrict these to ELF targets that support shared libs and PIC. if { [is_elf_format] && [check_lto_shared_available] } { run_cc_link_tests $lto_link_elf_tests + set testname "PR ld/15146 (2)" + 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"] + if { [ regexp "undefined reference to symbol '\\.?xxx'" $exec_output ] } { + pass $testname + } { + fail $testname + } set testname "PR ld/16746 (3)" set exec_output [run_host_cmd "$CC" "-O2 -flto -fuse-linker-plugin tmpdir/pr16746b.o tmpdir/pr16746d.o"] if { [ regexp "warning: \\.?foobar" $exec_output ] && ![ regexp "symbol from plugin" $exec_output ] } { diff --git a/ld/testsuite/ld-plugin/pr15146.d b/ld/testsuite/ld-plugin/pr15146.d new file mode 100644 index 00000000000..48d4b854466 --- /dev/null +++ b/ld/testsuite/ld-plugin/pr15146.d @@ -0,0 +1,4 @@ +#failif +#... + +0x[0-9a-f]+ +\(NEEDED\) +Shared library: +\[.*pr15146b.so\] +#... diff --git a/ld/testsuite/ld-plugin/pr15146a.c b/ld/testsuite/ld-plugin/pr15146a.c new file mode 100644 index 00000000000..d85fe973cbc --- /dev/null +++ b/ld/testsuite/ld-plugin/pr15146a.c @@ -0,0 +1,13 @@ +extern int xxx; + +int +bar (void) +{ + return xxx; +} + +int +main () +{ + return 0; +} diff --git a/ld/testsuite/ld-plugin/pr15146b.c b/ld/testsuite/ld-plugin/pr15146b.c new file mode 100644 index 00000000000..90eb21ea556 --- /dev/null +++ b/ld/testsuite/ld-plugin/pr15146b.c @@ -0,0 +1 @@ +int xxx = 3; diff --git a/ld/testsuite/ld-plugin/pr15146c.c b/ld/testsuite/ld-plugin/pr15146c.c new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/ld/testsuite/ld-plugin/pr15146c.c diff --git a/ld/testsuite/ld-plugin/pr15146d.c b/ld/testsuite/ld-plugin/pr15146d.c new file mode 100644 index 00000000000..3986ff62457 --- /dev/null +++ b/ld/testsuite/ld-plugin/pr15146d.c @@ -0,0 +1,7 @@ +extern int xxx; + +int +main () +{ + return xxx; +} |