diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2024-04-16 15:48:21 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2024-04-16 17:45:23 -0700 |
commit | c2fbf57864a2da2ceda81706a54d125ef3fce0a7 (patch) | |
tree | 15b12d00599ddfaccc3cee67e324b57040f011cb /ld | |
parent | 79484e95665430b6960425e5c50ffb9f90072bf4 (diff) | |
download | gdb-c2fbf57864a2da2ceda81706a54d125ef3fce0a7.zip gdb-c2fbf57864a2da2ceda81706a54d125ef3fce0a7.tar.gz gdb-c2fbf57864a2da2ceda81706a54d125ef3fce0a7.tar.bz2 |
elf: Skip the archive if the symbol isn't referenced
Also skip the archive if the symbol isn't referenced by a regular object.
bfd/
PR ld/31644
* elflink.c (elf_link_add_archive_symbols): Also skip the archive
if the symbol isn't referenced by a regular object.
ld/
PR ld/31644
* testsuite/ld-plugin/lto.exp: Run PR ld/31644 tests.
* testsuite/ld-plugin/pr31644a.c: New test.
* testsuite/ld-plugin/pr31644b.c: Likewise.
* testsuite/ld-plugin/pr31644c.c: Likewise.
Diffstat (limited to 'ld')
-rw-r--r-- | ld/testsuite/ld-plugin/lto.exp | 24 | ||||
-rw-r--r-- | ld/testsuite/ld-plugin/pr31644a.c | 13 | ||||
-rw-r--r-- | ld/testsuite/ld-plugin/pr31644b.c | 7 | ||||
-rw-r--r-- | ld/testsuite/ld-plugin/pr31644c.c | 5 |
4 files changed, 49 insertions, 0 deletions
diff --git a/ld/testsuite/ld-plugin/lto.exp b/ld/testsuite/ld-plugin/lto.exp index 35ce387..7b4b349 100644 --- a/ld/testsuite/ld-plugin/lto.exp +++ b/ld/testsuite/ld-plugin/lto.exp @@ -579,6 +579,22 @@ set lto_link_elf_tests [list \ "" \ "pr31615d.so" \ ] \ + [list \ + "Build pr31644b.a" \ + "" \ + "" \ + {pr31644b.c} \ + "" \ + "pr31644b.a" \ + ] \ + [list \ + "Build pr31644c.so" \ + "-shared" \ + "-fPIC" \ + {pr31644c.c} \ + "" \ + "pr31644c.so" \ + ] \ ] # PR 14918 checks that libgcc is not spuriously included in a shared link of @@ -788,6 +804,14 @@ set lto_run_elf_shared_tests [list \ {pr31615a.c} {pr31615b.exe} {pass.out} {-O3 -flto} {c} {} \ {-Wl,--as-needed tmpdir/pr31615c.so -Wl,--no-as-needed \ tmpdir/pr31615d.so}] \ + [list {pr31644a} \ + {-Wl,-R,tmpdir} {} \ + {pr31644a.c} {pr31644a.exe} {pass.out} {-flto} {c} {} \ + {-Wl,--no-as-needed tmpdir/pr31644b.a tmpdir/pr31644c.so}] \ + [list {pr31644b} \ + {-Wl,-R,tmpdir} {} \ + {pr31644a.c} {pr31644b.exe} {pass.out} {-flto} {c} {} \ + {-Wl,--as-needed tmpdir/pr31644b.a tmpdir/pr31644c.so}] \ ] # LTO run-time tests for ELF diff --git a/ld/testsuite/ld-plugin/pr31644a.c b/ld/testsuite/ld-plugin/pr31644a.c new file mode 100644 index 0000000..1c03a95 --- /dev/null +++ b/ld/testsuite/ld-plugin/pr31644a.c @@ -0,0 +1,13 @@ +#include <stdio.h> + +void +bar (void) +{ +} + +int +main() +{ + printf ("PASS\n"); + return 0; +} diff --git a/ld/testsuite/ld-plugin/pr31644b.c b/ld/testsuite/ld-plugin/pr31644b.c new file mode 100644 index 0000000..8b23ec8 --- /dev/null +++ b/ld/testsuite/ld-plugin/pr31644b.c @@ -0,0 +1,7 @@ +extern void bar (void); + +void +foo (void) +{ + bar (); +} diff --git a/ld/testsuite/ld-plugin/pr31644c.c b/ld/testsuite/ld-plugin/pr31644c.c new file mode 100644 index 0000000..3d54205 --- /dev/null +++ b/ld/testsuite/ld-plugin/pr31644c.c @@ -0,0 +1,5 @@ +__attribute__ ((weak)) +void +foo (void) +{ +} |