aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/lib
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2014-08-06 13:26:18 +0930
committerAlan Modra <amodra@gmail.com>2014-08-06 13:26:18 +0930
commitc3e11cbe51085fed6ca1c90f56611b8cbbabe3eb (patch)
tree702294bdfcf73ef89c4a4cbd52827849a3204a3e /ld/testsuite/lib
parent7cd4e5b756fa5c1ebe0ba7dd04e45d46330a7675 (diff)
downloadgdb-c3e11cbe51085fed6ca1c90f56611b8cbbabe3eb.zip
gdb-c3e11cbe51085fed6ca1c90f56611b8cbbabe3eb.tar.gz
gdb-c3e11cbe51085fed6ca1c90f56611b8cbbabe3eb.tar.bz2
Allow lto tests to run with older compilers
* lib/ld-lib.exp (check_lto_fat_available): New. (check_lto_available): Remove -ffat-lto-objects test. * ld-plugin/lto.exp: Use [list ] rather than { } to set up list variables, allowing substition of vars. Set lto_fat and plug_opt and add to various tests.
Diffstat (limited to 'ld/testsuite/lib')
-rw-r--r--ld/testsuite/lib/ld-lib.exp45
1 files changed, 44 insertions, 1 deletions
diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp
index 9dac6be..c4ce0e7 100644
--- a/ld/testsuite/lib/ld-lib.exp
+++ b/ld/testsuite/lib/ld-lib.exp
@@ -1424,6 +1424,15 @@ proc run_cc_link_tests { ldtests } {
set is_unresolved 0
set failed 0
+ #verbose -log "testname is $testname"
+ #verbose -log "ldflags is $ldflags"
+ #verbose -log "cflags is $cflags"
+ #verbose -log "src_files is $src_files"
+ #verbose -log "actions is $actions"
+ #verbose -log "binfile is $binfile"
+ #verbose -log "lang is $lang"
+ #verbose -log "warnings is $warnings"
+
# Compile each file in the test.
foreach src_file $src_files {
set fileroot "[file rootname [file tail $src_file]]"
@@ -1686,7 +1695,7 @@ proc check_lto_available { } {
puts $f "int main() { return 0; }"
close $f
remote_download host $src
- set lto_available_saved [run_host_cmd_yesno "$CC" "$flags -flto -ffat-lto-objects -fuse-linker-plugin $src -o $output"]
+ set lto_available_saved [run_host_cmd_yesno "$CC" "$flags -flto -fuse-linker-plugin $src -o $output"]
remote_file host delete $src
remote_file host delete $output
file delete $src
@@ -1694,6 +1703,40 @@ proc check_lto_available { } {
return $lto_available_saved
}
+# Returns true if the target compiler supports LTO -ffat-lto-objects
+proc check_lto_fat_available { } {
+ global lto_fat_available_saved
+ global CC
+
+ if {![info exists lto_fat_available_saved]} {
+ if { [which $CC] == 0 } {
+ set lto_fat_available_saved 0
+ return 0
+ }
+ # Check if gcc supports -flto -fuse-linker-plugin
+ set flags ""
+ if [board_info [target_info name] exists cflags] {
+ append flags " [board_info [target_info name] cflags]"
+ }
+ if [board_info [target_info name] exists ldflags] {
+ append flags " [board_info [target_info name] ldflags]"
+ }
+
+ set basename "tmpdir/lto[pid]"
+ set src ${basename}.c
+ set output ${basename}.out
+ set f [open $src "w"]
+ puts $f "int main() { return 0; }"
+ close $f
+ remote_download host $src
+ set lto_fat_available_saved [run_host_cmd_yesno "$CC" "$flags -flto -ffat-lto-objects -fuse-linker-plugin $src -o $output"]
+ remote_file host delete $src
+ remote_file host delete $output
+ file delete $src
+ }
+ return $lto_fat_available_saved
+}
+
# Returns true if the target compiler supports LTO and -shared
proc check_lto_shared_available { } {
global lto_shared_available_saved