aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2016-06-20 05:10:29 -0700
committerH.J. Lu <hjl.tools@gmail.com>2016-06-20 05:10:46 -0700
commit7dc3990e4002e0062007c1d41b56e04b5b8ec1ec (patch)
tree4e2190341e363ae4dac71d031c109ffd265aba04 /ld
parent9f99c22eb74a66e691b778cd15c24437f46d5818 (diff)
downloadfsf-binutils-gdb-7dc3990e4002e0062007c1d41b56e04b5b8ec1ec.zip
fsf-binutils-gdb-7dc3990e4002e0062007c1d41b56e04b5b8ec1ec.tar.gz
fsf-binutils-gdb-7dc3990e4002e0062007c1d41b56e04b5b8ec1ec.tar.bz2
Use the IR symbol table for the IR input object
ELF linker shouldn't skip the IR object when searching the symbol table of an archive element. If linker doesn't know if the object file is an IR object, it should give LTO plugin a chance to get the correct symbol table and use the IR symbol table if the input is an IR object. bfd/ PR ld/18250 PR ld/20267 * elflink.c: Include plugin.h if BFD_SUPPORTS_PLUGINS is defined. (elf_link_is_defined_archive_symbol): Call bfd_link_plugin_object_p on unknown plugin object and use the IR symbol table if the input is an IR object. * plugin.c (bfd_link_plugin_object_p): New function. * plugin.h (bfd_link_plugin_object_p): New prototype. ld/ PR ld/20267 * testsuite/ld-plugin/lto.exp (lto_link_tests): Add test for PR ld/20267. (lto_run_tests): Likewise. * testsuite/ld-plugin/pr20267a.c: New file. * testsuite/ld-plugin/pr20267b.c: Likewise.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog9
-rw-r--r--ld/testsuite/ld-plugin/lto.exp15
-rw-r--r--ld/testsuite/ld-plugin/pr20267a.c12
-rw-r--r--ld/testsuite/ld-plugin/pr20267b.c1
4 files changed, 37 insertions, 0 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index cd161ab..ca87628 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,4 +1,13 @@
2016-06-20 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/20267
+ * testsuite/ld-plugin/lto.exp (lto_link_tests): Add test for
+ PR ld/20267.
+ (lto_run_tests): Likewise.
+ * testsuite/ld-plugin/pr20267a.c: New file.
+ * testsuite/ld-plugin/pr20267b.c: Likewise.
+
+2016-06-20 H.J. Lu <hongjiu.lu@intel.com>
Alan Modra <amodra@gmail.com>
PR ld/20276
diff --git a/ld/testsuite/ld-plugin/lto.exp b/ld/testsuite/ld-plugin/lto.exp
index 7743719..80bc469 100644
--- a/ld/testsuite/ld-plugin/lto.exp
+++ b/ld/testsuite/ld-plugin/lto.exp
@@ -189,6 +189,15 @@ set lto_link_tests [list \
[list "Build pr20276b.o" \
"$plug_opt" "-flto $lto_no_fat" \
{pr20276b.c}] \
+ [list "Build pr20267a.o" \
+ "" "" \
+ {pr20267a.c}] \
+ [list "Build libpr20267a.a" \
+ "$plug_opt" "-flto $lto_fat" \
+ {pr20267b.c} {} "libpr20267a.a"] \
+ [list "Build libpr20267b.a" \
+ "$plug_opt" "-flto $lto_no_fat" \
+ {pr20267b.c} {} "libpr20267b.a"] \
]
if { [at_least_gcc_version 4 7] } {
@@ -341,6 +350,12 @@ set lto_run_tests [list \
[list "Run pr20276" \
"-O2 -flto tmpdir/pr20276a.o tmpdir/pr20276b.o" "" \
{dummy.c} "pr20276" "pass.out" "-flto -O2" "c"] \
+ [list "Run pr20267a" \
+ "-O2 -flto tmpdir/pr20267a.o tmpdir/libpr20267a.a" "" \
+ {dummy.c} "pr20267a" "pass.out" "-flto -O2" "c"] \
+ [list "Run pr20267b" \
+ "-O2 -flto tmpdir/pr20267a.o tmpdir/libpr20267b.a" "" \
+ {dummy.c} "pr20267b" "pass.out" "-flto -O2" "c"] \
]
if { [at_least_gcc_version 4 7] } {
diff --git a/ld/testsuite/ld-plugin/pr20267a.c b/ld/testsuite/ld-plugin/pr20267a.c
new file mode 100644
index 0000000..0b37bc7
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr20267a.c
@@ -0,0 +1,12 @@
+#include <stdio.h>
+
+int global_var;
+extern void abort ();
+
+int main(void)
+{
+ if (global_var != 20)
+ abort ();
+ printf ("PASS\n");
+ return 0;
+}
diff --git a/ld/testsuite/ld-plugin/pr20267b.c b/ld/testsuite/ld-plugin/pr20267b.c
new file mode 100644
index 0000000..2ecbc2c
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr20267b.c
@@ -0,0 +1 @@
+int global_var = 20;