aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2015-12-10 12:35:35 -0800
committerH.J. Lu <hjl.tools@gmail.com>2015-12-10 12:35:50 -0800
commitc5847ba7267b6eedd4b750f5eeece3ec037a27fd (patch)
tree4e4c0dce955a2d155dc9ad8ae1a46930613a53b6
parent60269a4a36a78063d7563a32a6d34107cb52cca5 (diff)
downloadgdb-c5847ba7267b6eedd4b750f5eeece3ec037a27fd.zip
gdb-c5847ba7267b6eedd4b750f5eeece3ec037a27fd.tar.gz
gdb-c5847ba7267b6eedd4b750f5eeece3ec037a27fd.tar.bz2
ld -r doesn't need plugin for slim lto object
Plugin isn't required on slim lto object for relocatable link. bfd/ PR ld/19317 * linker.c (_bfd_generic_link_add_one_symbol): Don't complain plugin needed to handle slim lto object for relocatable link. ld/testsuite/ PR ld/19317 * ld-plugin/lto.exp (lto_no_fat): New. (lto_link_tests): Add a test for PR ld/19317. (lto_run_tests): Likewise. (run_ld_link_tests): Likewise.
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/linker.c3
-rw-r--r--ld/testsuite/ChangeLog8
-rw-r--r--ld/testsuite/ld-plugin/lto.exp14
-rw-r--r--ld/testsuite/ld-plugin/pr19317.c8
-rw-r--r--ld/testsuite/ld-plugin/pr19317.out1
6 files changed, 39 insertions, 1 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index a306cca..85f3ed4 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2015-12-10 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/19317
+ * linker.c (_bfd_generic_link_add_one_symbol): Don't complain
+ plugin needed to handle slim lto object for relocatable link.
+
2015-12-09 Sandra Loosemore <sandra@codesourcery.com>
* elf32-nios2.c (nios2_elf32_finish_dynamic_sections): Correct
diff --git a/bfd/linker.c b/bfd/linker.c
index 86a7a19..6c59102 100644
--- a/bfd/linker.c
+++ b/bfd/linker.c
@@ -1475,7 +1475,8 @@ _bfd_generic_link_add_one_symbol (struct bfd_link_info *info,
else if (bfd_is_com_section (section))
{
row = COMMON_ROW;
- if (strcmp (name, "__gnu_lto_slim") == 0)
+ if (!bfd_link_relocatable (info)
+ && strcmp (name, "__gnu_lto_slim") == 0)
(*_bfd_error_handler)
(_("%s: plugin needed to handle lto object"),
bfd_get_filename (abfd));
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 38d9c77..3ce86d6 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2015-12-10 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/19317
+ * ld-plugin/lto.exp (lto_no_fat): New.
+ (lto_link_tests): Add a test for PR ld/19317.
+ (lto_run_tests): Likewise.
+ (run_ld_link_tests): Likewise.
+
2015-12-07 Jan Beulich <jbeulich@suse.com>
* ld-elf/gabiend.rt: Accept any alignment.
diff --git a/ld/testsuite/ld-plugin/lto.exp b/ld/testsuite/ld-plugin/lto.exp
index 81e72b4..fb951df 100644
--- a/ld/testsuite/ld-plugin/lto.exp
+++ b/ld/testsuite/ld-plugin/lto.exp
@@ -55,8 +55,10 @@ foreach plug $plugin_names {
}
}
set lto_fat ""
+set lto_no_fat ""
if { [check_lto_fat_available] } {
set lto_fat "-ffat-lto-objects"
+ set lto_no_fat "-fno-fat-lto-objects"
}
# Simple LTO tests and generate input files for complex LTO tests.
@@ -178,6 +180,9 @@ set lto_link_tests [list \
[list "PR ld/pr16846(2)" \
"-flto -fuse-linker-plugin tmpdir/pr16846a.o tmpdir/pr16846c.o tmpdir/pr16846b.o" "" \
{dummy.c} {} "pr16846b.exe"] \
+ [list "PR ld/19317 (1)" \
+ "$plug_opt" "-flto $lto_no_fat" \
+ {pr19317.c} {} "libpr19317.a"] \
]
if { [at_least_gcc_version 4 7] } {
@@ -324,6 +329,9 @@ set lto_run_tests [list \
[list "PR ld/15323 (4)" \
"-O2 -flto tmpdir/pr15323a-r.o" "" \
{dummy.c} "pr15323a.exe" "pr15323.out" "-flto -O2" "c"] \
+ [list "PR ld/19317 (3)" \
+ "-O2 -flto tmpdir/pr19317-r.o" "" \
+ {dummy.c} "pr19317.exe" "pr19317.out" "-flto -O2" "c"] \
]
if { [at_least_gcc_version 4 7] } {
@@ -424,6 +432,12 @@ remote_exec host "mv" "tmpdir/dump tmpdir/lto-5.o"
run_cc_link_tests $lto_link_symbol_tests
+run_ld_link_tests [list \
+ [list "PR ld/19317 (2)" \
+ "-r tmpdir/pr19317.o" "" "" \
+ {dummy.s} {} "pr19317-r.o"] \
+]
+
# The following tests require running the executable generated by ld.
if ![isnative] {
return
diff --git a/ld/testsuite/ld-plugin/pr19317.c b/ld/testsuite/ld-plugin/pr19317.c
new file mode 100644
index 0000000..7189d88
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr19317.c
@@ -0,0 +1,8 @@
+#include <stdio.h>
+
+int
+main ()
+{
+ printf ("OK\n");
+ return 0;
+}
diff --git a/ld/testsuite/ld-plugin/pr19317.out b/ld/testsuite/ld-plugin/pr19317.out
new file mode 100644
index 0000000..d86bac9
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr19317.out
@@ -0,0 +1 @@
+OK