From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id 412073857004; Mon, 12 Sep 2022 11:56:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 412073857004 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 35CB9113E; Mon, 12 Sep 2022 04:57:01 -0700 (PDT) Received: from localhost (e121540-lin.manchester.arm.com [10.32.98.62]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 3EA203F71A; Mon, 12 Sep 2022 04:56:54 -0700 (PDT) From: Richard Sandiford To: =?utf-8?Q?Torbj=C3=B6rn?= SVENSSON via Gcc-patches Mail-Followup-To: =?utf-8?Q?Torbj=C3=B6rn?= SVENSSON via Gcc-patches , =?utf-8?Q?Torbj=C3=B6rn?= SVENSSON , aoliva@gcc.gnu.org, richard.sandiford@arm.com Cc: =?utf-8?Q?Torbj=C3=B6rn?= SVENSSON , aoliva@gcc.gnu.org Subject: Re: [PATCH] testsuite: gluefile file need to be prefixed References: <20220909130313.2562293-1-torbjorn.svensson@foss.st.com> Date: Mon, 12 Sep 2022 12:56:52 +0100 In-Reply-To: <20220909130313.2562293-1-torbjorn.svensson@foss.st.com> (=?utf-8?Q?=22Torbj=C3=B6rn?= SVENSSON via Gcc-patches"'s message of "Fri, 9 Sep 2022 15:03:14 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-48.7 required=5.0 tests=BAYES_00,GIT_PATCH_0,KAM_DMARC_NONE,KAM_DMARC_STATUS,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Torbj=C3=B6rn SVENSSON via Gcc-patches writes: > PR/95720 > When the status wrapper is used, the gluefile need to be prefixed with > -Wl, in order for the test cases to have the dump files with the > expected names. > > gcc/testsuite/ChangeLog: > > * gcc/testsuite/lib/g++.exp: Moved gluefile block to after > flags have been prefixed for the target_compile call. > * gcc/testsuite/lib/gcc.exp: Likewise. > * gcc/testsuite/lib/wrapper.exp: Reset adjusted state flag. I agree this looks right, but I'm curious how you ended up with the behaviour seen in comment 16. I thought having: if { [target_info needs_status_wrapper] !=3D "" && [info exists gluefil= e] } { lappend options "libs=3D${gluefile}" lappend options "ldflags=3D${wrap_flags}" } before the dg-additional-files-options/gcc_adjusted_linker_flags would lead to the gluefile missing a "-Wl," first time round. How is it that the gluefile still gets the "-Wl," and the -T misses it instead? Thanks, Richard > Co-Authored-By: Yvan ROUX > Signed-off-by: Torbj=C3=B6rn SVENSSON > --- > gcc/testsuite/lib/g++.exp | 10 +++++----- > gcc/testsuite/lib/gcc.exp | 21 +++++++++++---------- > gcc/testsuite/lib/wrapper.exp | 7 ++++++- > 3 files changed, 22 insertions(+), 16 deletions(-) > > diff --git a/gcc/testsuite/lib/g++.exp b/gcc/testsuite/lib/g++.exp > index 24ef068b239..16e61fb4ad4 100644 > --- a/gcc/testsuite/lib/g++.exp > +++ b/gcc/testsuite/lib/g++.exp > @@ -303,11 +303,6 @@ proc g++_target_compile { source dest type options }= { > global flags_to_postpone > global board_info >=20=20 > - if { [target_info needs_status_wrapper] !=3D "" && [info exists glue= file] } { > - lappend options "libs=3D${gluefile}" > - lappend options "ldflags=3D${wrap_flags}" > - } > - > global TEST_EXTRA_LIBS > if [info exists TEST_EXTRA_LIBS] { > lappend options "ldflags=3D$TEST_EXTRA_LIBS" > @@ -333,6 +328,11 @@ proc g++_target_compile { source dest type options }= { >=20=20 > set options [dg-additional-files-options $options $source] >=20=20 > + if { [target_info needs_status_wrapper] !=3D "" && [info exists glue= file] } { > + lappend options "libs=3D${gluefile}" > + lappend options "ldflags=3D${wrap_flags}" > + } > + > set result [target_compile $source $dest $type $options] >=20=20 > if {[board_info $tboard exists multilib_flags]} { > diff --git a/gcc/testsuite/lib/gcc.exp b/gcc/testsuite/lib/gcc.exp > index 1b25ebec4cf..2f145d0fdf4 100644 > --- a/gcc/testsuite/lib/gcc.exp > +++ b/gcc/testsuite/lib/gcc.exp > @@ -129,16 +129,6 @@ proc gcc_target_compile { source dest type options }= { > global flags_to_postpone > global board_info >=20=20 > - if {[target_info needs_status_wrapper] !=3D "" && \ > - [target_info needs_status_wrapper] !=3D "0" && \ > - [info exists gluefile] } { > - lappend options "libs=3D${gluefile}" > - lappend options "ldflags=3D$wrap_flags" > - if { $type =3D=3D "executable" } { > - set options [concat "{additional_flags=3D-dumpbase \"\"}" $options] > - } > - } > - > global TEST_EXTRA_LIBS > if [info exists TEST_EXTRA_LIBS] { > lappend options "ldflags=3D$TEST_EXTRA_LIBS" > @@ -170,6 +160,17 @@ proc gcc_target_compile { source dest type options }= { > lappend options "timeout=3D[timeout_value]" > lappend options "compiler=3D$GCC_UNDER_TEST" > set options [dg-additional-files-options $options $source] > + > + if {[target_info needs_status_wrapper] !=3D "" && \ > + [target_info needs_status_wrapper] !=3D "0" && \ > + [info exists gluefile] } { > + lappend options "libs=3D${gluefile}" > + lappend options "ldflags=3D$wrap_flags" > + if { $type =3D=3D "executable" } { > + set options [concat "{additional_flags=3D-dumpbase \"\"}" $options] > + } > + } > + > set return_val [target_compile $source $dest $type $options] >=20=20 > if {[board_info $tboard exists multilib_flags]} { > diff --git a/gcc/testsuite/lib/wrapper.exp b/gcc/testsuite/lib/wrapper.exp > index 5a601b269da..4a7d56941fc 100644 > --- a/gcc/testsuite/lib/wrapper.exp > +++ b/gcc/testsuite/lib/wrapper.exp > @@ -22,7 +22,7 @@ > # the compiler when compiling FILENAME. >=20=20 > proc ${tool}_maybe_build_wrapper { filename args } { > - global gluefile wrap_flags > + global gluefile wrap_flags gcc_adjusted_linker_flags >=20=20 > if { [target_info needs_status_wrapper] !=3D "" \ > && [target_info needs_status_wrapper] !=3D "0" \ > @@ -43,6 +43,11 @@ proc ${tool}_maybe_build_wrapper { filename args } { > if { $result !=3D "" } { > set gluefile [lindex $result 0] > set wrap_flags [lindex $result 1] > + > + # Reset the cached state of the adjusted flags > + if { [info exists gcc_adjusted_linker_flags] } { > + set gcc_adjusted_linker_flags 0 > + } > } > } > }