From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27540 invoked by alias); 11 Oct 2013 12:36:36 -0000 Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org Received: (qmail 27529 invoked by uid 89); 11 Oct 2013 12:36:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: service87.mimecast.com Received: from service87.mimecast.com (HELO service87.mimecast.com) (91.220.42.44) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 11 Oct 2013 12:36:34 +0000 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Fri, 11 Oct 2013 13:36:32 +0100 Received: from [10.1.208.33] ([10.1.255.212]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.0); Fri, 11 Oct 2013 13:36:30 +0100 Message-ID: <5257F0CE.1030804@arm.com> Date: Fri, 11 Oct 2013 12:36:00 -0000 From: Richard Earnshaw User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:15.0) Gecko/20120907 Thunderbird/15.0.1 MIME-Version: 1.0 To: "H.J. Lu" CC: binutils@sourceware.org Subject: Re: PATCH: Add check_lto_available References: <20121207175814.GC13783@intel.com> In-Reply-To: <20121207175814.GC13783@intel.com> X-MC-Unique: 113101113363205001 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2013-10/txt/msg00160.txt.bz2 HJ, Why does this patch try to produce a shared object as part of determining whether LTO works? If you have LTO but not shared object support in a toolchain this means we don't test LTO properly. R. On 07/12/12 17:58, H.J. Lu wrote: > Hi, >=20 > I checked in this patch to add check_lto_available to check if > compiler supports LTO. >=20 >=20 > H.J. > --- > Index: ChangeLog > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > RCS file: /cvs/src/src/ld/testsuite/ChangeLog,v > retrieving revision 1.1637 > diff -u -p -r1.1637 ChangeLog > --- ChangeLog 7 Dec 2012 17:53:03 -0000 1.1637 > +++ ChangeLog 7 Dec 2012 17:55:20 -0000 > @@ -1,5 +1,10 @@ > 2012-12-07 H.J. Lu >=20=20 > + * lib/ld-lib.exp (check_lto_available): New. Check if compiler > + supports LTO. > + > +2012-12-07 H.J. Lu > + > * lib/ld-lib.exp (run_cc_link_tests): Properly check linker > warnings. >=20=20 > Index: lib/ld-lib.exp > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > RCS file: /cvs/src/src/ld/testsuite/lib/ld-lib.exp,v > retrieving revision 1.99 > diff -u -p -r1.99 ld-lib.exp > --- lib/ld-lib.exp 7 Dec 2012 17:53:04 -0000 1.99 > +++ lib/ld-lib.exp 7 Dec 2012 17:55:20 -0000 > @@ -1614,6 +1614,34 @@ proc check_plugin_api_available { } { > return $plugin_api_available_saved > } >=20=20 > +# 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] =3D=3D 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 -fus= e-linker-plugin $src -o $output"] > + if { [lindex $status 0] =3D=3D 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. >=20=20 > proc check_as_cfi { } { >=20