This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] PR ld/20436: Skip LTO tests for --disable-plugin
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Alan Modra <amodra at gmail dot com>
- Cc: Binutils <binutils at sourceware dot org>
- Date: Tue, 9 Aug 2016 16:42:26 -0700
- Subject: Re: [PATCH] PR ld/20436: Skip LTO tests for --disable-plugin
- Authentication-results: sourceware.org; auth=none
- References: <20160808192831.GA7590@intel.com> <20160808232710.GC20904@bubble.grove.modra.org>
On Mon, Aug 8, 2016 at 4:27 PM, Alan Modra <amodra@gmail.com> wrote:
> On Mon, Aug 08, 2016 at 12:28:31PM -0700, H.J. Lu wrote:
>> diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp
>> index cd9e930..3c27ca7 100644
>> --- a/ld/testsuite/lib/ld-lib.exp
>> +++ b/ld/testsuite/lib/ld-lib.exp
>> @@ -1808,13 +1808,35 @@ proc check_sysroot_available { } {
>> return $ld_sysroot_available_saved
>> }
>>
>> +# Returns 1 if plugin is disabled in gcc. Returns 0 otherwise.
>> +proc check_gcc_plugin_disabled { } {
>> + 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 1;
>> + }
>> + }
>> +
>> + return 0;
>> +}
>> +
>> # 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 { [which $CC] == 0 || [ check_gcc_plugin_disabled ] } {
>> set lto_available_saved 0
>> return 0
>> }
>
> I think this would be cleaner with check_gcc_plugin_disabled return
> value inverted and the function called check_gcc_plugin_enabled.
> Then the last hunk could be written as
>
> if { [!check_gcc_plugin_enabled] } {
>
> OK with that change.
This is what I checked in.
Thanks.
--
H.J.
From 9b4b093116c8d33654e274d03d2966b33495dfd9 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Fri, 5 Aug 2016 13:34:53 -0700
Subject: [PATCH] Skip LTO tests for --disable-plugin
Don't run LTO tests if compiler is configured with --disable-plugin.
---
ld/testsuite/lib/ld-lib.exp | 28 +++++++++++++++++++++++++---
1 file changed, 25 insertions(+), 3 deletions(-)
diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp
index cd9e930..b3cdb70 100644
--- a/ld/testsuite/lib/ld-lib.exp
+++ b/ld/testsuite/lib/ld-lib.exp
@@ -1808,13 +1808,35 @@ proc check_sysroot_available { } {
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
}
@@ -1857,7 +1879,7 @@ proc check_lto_fat_available { } {
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
}
@@ -1900,7 +1922,7 @@ proc check_lto_shared_available { } {
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
}
--
2.7.4