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.
This commit is contained in:
H.J. Lu 2015-12-10 12:35:35 -08:00
parent 60269a4a36
commit c5847ba726
6 changed files with 39 additions and 1 deletions

View File

@ -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

View File

@ -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));

View File

@ -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.

View File

@ -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

View File

@ -0,0 +1,8 @@
#include <stdio.h>
int
main ()
{
printf ("OK\n");
return 0;
}

View File

@ -0,0 +1 @@
OK