lto.exp (lto-link-and-maybe-run): Use the default linker script when relocatable linking.

* lib/lto.exp (lto-link-and-maybe-run): Use the default linker
	script when relocatable linking.

From-SVN: r165494
This commit is contained in:
Jie Zhang 2010-10-15 06:53:42 +00:00 committed by Jie Zhang
parent 56f01f0b41
commit af41386e7c
2 changed files with 25 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2010-10-15 Jie Zhang <jie@codesourcery.com>
* lib/lto.exp (lto-link-and-maybe-run): Use the default linker
script when relocatable linking.
2010-10-14 Yao Qi <yao@codesourcery.com> 2010-10-14 Yao Qi <yao@codesourcery.com>
PR target/45447 PR target/45447

View File

@ -163,6 +163,7 @@ proc lto-link-and-maybe-run { testname objlist dest optall optfile optstr } {
global testcase global testcase
global tool global tool
global compile_type global compile_type
global board_info
# Check that all of the objects were built successfully. # Check that all of the objects were built successfully.
foreach obj [split $objlist] { foreach obj [split $objlist] {
@ -177,10 +178,29 @@ proc lto-link-and-maybe-run { testname objlist dest optall optfile optstr } {
set options "" set options ""
lappend options "additional_flags=$optall $optfile" lappend options "additional_flags=$optall $optfile"
set target_board [target_info name]
set relocatable 0
# Some LTO tests do relocatable linking. Some target boards set
# a linker script which can't be used for relocatable linking.
# Use the default linker script instead.
if { [lsearch -exact [split "$optall $optfile"] "-r"] >= 0 } {
set relocatable 1
}
if { $relocatable } {
set saved_ldscript [board_info $target_board ldscript]
set board_info($target_board,ldscript) ""
}
# Link the objects into an executable. # Link the objects into an executable.
set comp_output [${tool}_target_compile "$objlist" $dest executable \ set comp_output [${tool}_target_compile "$objlist" $dest executable \
"$options"] "$options"]
if { $relocatable } {
set board_info($target_board,ldscript) $saved_ldscript
}
# Prune unimportant visibility warnings before checking output. # Prune unimportant visibility warnings before checking output.
set comp_output [lto_prune_warns $comp_output] set comp_output [lto_prune_warns $comp_output]