+2016-08-09 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/20436
+ * testsuite/lib/ld-lib.exp (check_gcc_plugin_enabled): New
+ proc.
+ (check_lto_available): Return 0 if check_gcc_plugin_enabled
+ returns 0.
+ (check_lto_fat_available): Likewise.
+ (check_lto_shared_available): Likewise.
+
2016-08-09 Roland McGrath <roland@hack.frob.com>
* emulparams/armelf.sh (GENERATE_PIE_SCRIPT): Set to yes.
return $ld_sysroot_available_saved
}
+# Returns 1 if plugin is enabled in gcc. Returns 0 otherwise.
+proc check_gcc_plugin_enabled { } {
+ global CC
+
+ if {![info exists CC]} {
+ set CC [find_gcc]
+ }
+ if { $CC == "" } {
+ return 0
+ }
+ set state [remote_exec host $CC -v]
+ for { set i 0 } { $i < [llength $state] } { incr i } {
+ set v [lindex $state $i]
+ if { [ string match "*--disable-plugin*" $v ] } {
+ verbose "plugin is disabled by $v"
+ return 0;
+ }
+ }
+
+ return 1;
+}
+
# Returns true if the target compiler supports LTO
proc check_lto_available { } {
global lto_available_saved
global CC
if {![info exists lto_available_saved]} {
- if { [which $CC] == 0 } {
+ if { ![check_gcc_plugin_enabled] } {
set lto_available_saved 0
return 0
}
global CC
if {![info exists lto_fat_available_saved]} {
- if { [which $CC] == 0 } {
+ if { ![check_gcc_plugin_enabled] } {
set lto_fat_available_saved 0
return 0
}
global CC
if {![info exists lto_shared_available_saved]} {
- if { [which $CC] == 0 } {
+ if { ![check_gcc_plugin_enabled] } {
set lto_shared_available_saved 0
return 0
}