summaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-plugin/pr20103b.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2016-05-17 07:59:52 -0700
committerH.J. Lu <hjl.tools@gmail.com>2016-05-17 09:56:56 -0700
commit85ff5b7b6638ef04f745f0b8fd4418499a3676c6 (patch)
tree630fbe91d01d721e022618ac6162795f0f499e4c /ld/testsuite/ld-plugin/pr20103b.c
parent68bce0209f2be6d0f852ef7092b9d412d78fd43a (diff)
downloadbinutils-gdb-users/hjl/pr20103.tar.gz
Skip an archive element if not added by linkerusers/hjl/pr20103
During archive rescan to resolve symbol references for files added by LTO, linker add_archive_element callback is called to check if an archive element should added. After all IR symbols have been claimed, linker won't claim new IR symbols and shouldn't add the LTO archive element. This patch updates linker add_archive_element callback to return FALSE when seeing an LTO archive element during rescan and changes ELF linker to skip such archive element. Other linker backends may also need similar update. bfd/ PR ld/20103 * elflink.c (elf_link_add_archive_symbols): Skip archive element if linker add_archive_element callback returns FALSE. ld/ PR ld/20103 * ldmain.c (add_archive_element): Don't claim new IR symbols after all IR symbols have been claimed. * plugin.c (plugin_call_claim_file): Remove no_more_claiming check. * testsuite/ld-plugin/lto.exp (pr20103): New proc. Run PR ld/20103 tests. * testsuite/ld-plugin/pr20103a.c: New file. * testsuite/ld-plugin/pr20103b.c: Likewise. * testsuite/ld-plugin/pr20103c.c: Likewise.
Diffstat (limited to 'ld/testsuite/ld-plugin/pr20103b.c')
-rw-r--r--ld/testsuite/ld-plugin/pr20103b.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/ld/testsuite/ld-plugin/pr20103b.c b/ld/testsuite/ld-plugin/pr20103b.c
new file mode 100644
index 00000000000..ead122dbe9b
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr20103b.c
@@ -0,0 +1,3 @@
+void dead()
+{
+}