aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-plugin/lto.exp
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2020-10-30 14:56:35 +1030
committerAlan Modra <amodra@gmail.com>2020-11-02 09:39:53 +1030
commitb1a92c635c1ec10fd703302ce1fc4ab3a8515a04 (patch)
tree80c9f60d71a1d360f6a223b8d3ee4c330a5af55d /ld/testsuite/ld-plugin/lto.exp
parentae7754b256f1f230baec364d90561c3ca34f7e64 (diff)
downloadgdb-b1a92c635c1ec10fd703302ce1fc4ab3a8515a04.zip
gdb-b1a92c635c1ec10fd703302ce1fc4ab3a8515a04.tar.gz
gdb-b1a92c635c1ec10fd703302ce1fc4ab3a8515a04.tar.bz2
PR26806, Suspected linker bug with LTO
This patch reverts most of git commit 1e3b96fd6cf, so IR symbols are again not marked def_regular or ref_regular. That should be enough to stop IR symbols from becoming dynamic. To mark as-needed shared libraries referenced by IR symbols, use the referencing BFD rather than the ref flags. bfd/ PR 15146 PR 26314 PR 26530 PR 26806 * elflink.c (elf_link_add_object_symbols): Don't set def/ref flags for plugin syms. Do allow plugin syms to mark as-needed libs. ld/ PR 26806 * testsuite/ld-plugin/lto-19.h, * testsuite/ld-plugin/lto-19a.c, * testsuite/ld-plugin/lto-19b.c, * testsuite/ld-plugin/lto-19c.c: New test. * testsuite/ld-plugin/pr26806.c, * testsuite/ld-plugin/pr26806.d: New test. * testsuite/ld-plugin/lto.exp: Run them.
Diffstat (limited to 'ld/testsuite/ld-plugin/lto.exp')
-rw-r--r--ld/testsuite/ld-plugin/lto.exp16
1 files changed, 16 insertions, 0 deletions
diff --git a/ld/testsuite/ld-plugin/lto.exp b/ld/testsuite/ld-plugin/lto.exp
index 9f9f2d1..23c948c 100644
--- a/ld/testsuite/ld-plugin/lto.exp
+++ b/ld/testsuite/ld-plugin/lto.exp
@@ -403,6 +403,18 @@ set lto_link_elf_tests [list \
[list {lto-18d.o} \
{} {-flto -O2} \
{lto-18d.c} {} {}] \
+ [list {liblto-19.a} \
+ "$plug_opt" {-flto -O2 -fPIC} \
+ {lto-19a.c} {} {liblto-19.a}] \
+ [list {compile lto-19b.c} \
+ "$plug_opt" {-flto -O2 -fPIC} \
+ {lto-19b.c} {} {} {c}] \
+ [list {liblto-19.so} \
+ {-shared tmpdir/lto-19b.o tmpdir/liblto-19.a} {-O2 -fPIC} \
+ {dummy.c} {} {liblto-19.so}] \
+ [list {pr26806.so} \
+ {-shared} {-fpic -O2 -flto} \
+ {pr26806.c} {{nm {-D} pr26806.d}} {pr26806.so}] \
]
# PR 14918 checks that libgcc is not spuriously included in a shared link of
@@ -584,6 +596,10 @@ set lto_run_elf_shared_tests [list \
{-static -flto -fuse-linker-plugin} {} \
{lto-18a.c} {lto-18-4.exe} {lto-18.out} {-flto -O2} {c} {} \
{ -Ltmpdir -llto-18b -llto-18c tmpdir/lto-18d.o}] \
+ [list {lto-19} \
+ {-Wl,--as-needed,-R,tmpdir} {} \
+ {lto-19c.c} {lto-19.exe} {pass.out} {-flto -O2} {c} {} \
+ {tmpdir/liblto-19.so tmpdir/liblto-19.a}] \
]
# LTO run-time tests for ELF