mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-07-01 18:32:32 +08:00
Add check_lto_available
* lib/ld-lib.exp (check_lto_available): New. Check if compiler supports LTO.
This commit is contained in:
@ -1,3 +1,8 @@
|
|||||||
|
2012-12-07 H.J. Lu <hongjiu.lu@intel.com>
|
||||||
|
|
||||||
|
* lib/ld-lib.exp (check_lto_available): New. Check if compiler
|
||||||
|
supports LTO.
|
||||||
|
|
||||||
2012-12-07 H.J. Lu <hongjiu.lu@intel.com>
|
2012-12-07 H.J. Lu <hongjiu.lu@intel.com>
|
||||||
|
|
||||||
* lib/ld-lib.exp (run_cc_link_tests): Properly check linker
|
* lib/ld-lib.exp (run_cc_link_tests): Properly check linker
|
||||||
|
@ -1614,6 +1614,34 @@ proc check_plugin_api_available { } {
|
|||||||
return $plugin_api_available_saved
|
return $plugin_api_available_saved
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Returns true if the target compiler supports LTO
|
||||||
|
proc check_lto_available { } {
|
||||||
|
global lto_available_saved
|
||||||
|
global CC
|
||||||
|
if {![info exists lto_available_saved]} {
|
||||||
|
# Check if gcc supports -flto -fuse-linker-plugin
|
||||||
|
if { [which $CC] == 0 } {
|
||||||
|
set lto_available_saved 0
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
set basename "lto"
|
||||||
|
set src ${basename}[pid].c
|
||||||
|
set output ${basename}[pid].so
|
||||||
|
set f [open $src "w"]
|
||||||
|
puts $f ""
|
||||||
|
close $f
|
||||||
|
set status [remote_exec host $CC "-shared -B[pwd]/tmpdir/ld/ -flto -fuse-linker-plugin $src -o $output"]
|
||||||
|
if { [lindex $status 0] == 0 } {
|
||||||
|
set lto_available_saved 1
|
||||||
|
} else {
|
||||||
|
set lto_available_saved 0
|
||||||
|
}
|
||||||
|
file delete $src
|
||||||
|
file delete $output
|
||||||
|
}
|
||||||
|
return $lto_available_saved
|
||||||
|
}
|
||||||
|
|
||||||
# Check if the assembler supports CFI statements.
|
# Check if the assembler supports CFI statements.
|
||||||
|
|
||||||
proc check_as_cfi { } {
|
proc check_as_cfi { } {
|
||||||
|
Reference in New Issue
Block a user