This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[testsuite] Improve LTO testing with -r
- From: Jie Zhang <jie at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Mark Mitchell <mark at codesourcery dot com>
- Date: Mon, 11 Oct 2010 23:53:32 +0800
- Subject: [testsuite] Improve LTO testing with -r
Some LTO tests do relocatable linking. Some target boards set a linker
script which can't be used for relocatable linking. This patch changes
lto.exp to use the default linker script instead if -r is found in the
options.
make check RUNTESTFLAGS="lto.exp"
has no regressions on x86_64-unknown-linux-gnu with this patch.
Is it OK?
Regards,
--
Jie Zhang
CodeSourcery
* lib/lto.exp (lto-link-and-maybe-run): Use the default linker
script when relocatable linking.
Index: lib/lto.exp
===================================================================
--- lib/lto.exp (revision 165315)
+++ lib/lto.exp (working copy)
@@ -163,6 +163,7 @@ proc lto-link-and-maybe-run { testname o
global testcase
global tool
global compile_type
+ global board_info
# Check that all of the objects were built successfully.
foreach obj [split $objlist] {
@@ -177,10 +178,29 @@ proc lto-link-and-maybe-run { testname o
set options ""
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.
set comp_output [${tool}_target_compile "$objlist" $dest executable \
"$options"]
+ if { $relocatable } {
+ set board_info($target_board,ldscript) $saved_ldscript
+ }
+
# Prune unimportant visibility warnings before checking output.
set comp_output [lto_prune_warns $comp_output]