Message ID | 20220909130313.2562293-1-torbjorn.svensson@foss.st.com |
---|---|
State | New, archived |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5044:0:0:0:0:0 with SMTP id h4csp704878wrt; Fri, 9 Sep 2022 06:04:45 -0700 (PDT) X-Google-Smtp-Source: AA6agR68X44W43h+G6ymvcam3ka6sOM5uef3JkX9FEBiuCLfsDq6kGrm++2puh5rdvflfppBdj3k X-Received: by 2002:a05:6402:1445:b0:44d:844d:e76e with SMTP id d5-20020a056402144500b0044d844de76emr11019825edx.313.1662728684898; Fri, 09 Sep 2022 06:04:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662728684; cv=none; d=google.com; s=arc-20160816; b=R50nFttk3csBeSi4D8IwBffRMBXqRJvP96+c/No3MZUcwLHbtkkpmung6GJbZQBnY0 qNop/p5Gs9vHREi0r5txeh+fuepO8SCd43HdG2+ZlcAs8dv9Zp0lcQ4xvd8sAPoZhtiM Go62iDcCT7ywCssicpuzw8SD36t4GLUvKxDQg0v7UrTwgKUPV/XhAu5iNtbquFaio4f6 41EucYs8beDtoJLJm6xVlX6bcphDZXBaZxjEcA1KCE972hRWwlp3eNLHdkl+0PFNlihf ahqrt++tw1gKEgjTVGN8blxrvr7Kotx9ReC8VIUL2SvVcVBnH51QmCoP+8XKEeL8U1iS CQyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:reply-to:from:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:to :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=lkh3DqYE3U/JwIKPy0OyHbDua7heP2YDftGG1qXjuMU=; b=B6PNLfJeJe1U7OZ7k4fNlyc775ROH5gRoHxZzJ5gWWHW4E3P70lY1D7BKD4nWzTY5f EZuxfrVIB6IvX3faCiqsAksE3yryNoN3mJdEwLMLe4bot3uHM0yyQ2rK6C51SjMj5aiB HqGFf4HNHc26fDf+BF5Z5BYQ49LcOA32SJIQSWjVXsJsYML35Da0reG5Y162WOJ6E7x6 Mizk3WVwzkm/aXimnfPg5Qy8rkaRqu/TjzsIz6dQU1pPC5Pbu47losouNmpN3sjzQ9Er 2KB5lkRVXdSz7mBhIDOZnxUtQaKDJ85aQxdoPqZG+QODEKIoEDm96HAJWTDLLiKYoZwx 41xQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=oUqOkLDt; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id hz4-20020a1709072ce400b0077086d80875si357907ejc.538.2022.09.09.06.04.44 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Sep 2022 06:04:44 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=oUqOkLDt; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5249F3857348 for <ouuuleilei@gmail.com>; Fri, 9 Sep 2022 13:04:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5249F3857348 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1662728683; bh=lkh3DqYE3U/JwIKPy0OyHbDua7heP2YDftGG1qXjuMU=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=oUqOkLDtUR72oAAiipGSOo9Lx7/+Jlcixwlad1aIyQA2S8bKlO5Wj6INqMGj1t6L7 6zANlxxkNaeh8ioq7PYF+ZpM+k+x1+m8QKuaT86jTPiW/N/00qswcOU2v2PdeEb6pL D/KlMvjbEvLetwNfR7lv403PMmKwZBhKnqespsjQ= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) by sourceware.org (Postfix) with ESMTPS id 30EC23857C4B; Fri, 9 Sep 2022 13:03:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 30EC23857C4B Received: from pps.filterd (m0288072.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2899xr2g025384; Fri, 9 Sep 2022 15:03:49 +0200 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3jg3bns1m9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 09 Sep 2022 15:03:49 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id E27E710002A; Fri, 9 Sep 2022 15:03:46 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node3.st.com [10.75.129.71]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id DE3CB22D199; Fri, 9 Sep 2022 15:03:46 +0200 (CEST) Received: from jkgcxl0002.jkg.st.com (10.75.127.48) by SHFDAG1NODE3.st.com (10.75.129.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2375.31; Fri, 9 Sep 2022 15:03:43 +0200 To: <gcc-patches@gcc.gnu.org> Subject: [PATCH] testsuite: gluefile file need to be prefixed Date: Fri, 9 Sep 2022 15:03:14 +0200 Message-ID: <20220909130313.2562293-1-torbjorn.svensson@foss.st.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.75.127.48] X-ClientProxiedBy: SFHDAG2NODE3.st.com (10.75.127.6) To SHFDAG1NODE3.st.com (10.75.129.71) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-09-09_08,2022-09-09_01,2022-06-22_01 X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> From: =?utf-8?q?Torbj=C3=B6rn_SVENSSON_via_Gcc-patches?= <gcc-patches@gcc.gnu.org> Reply-To: =?utf-8?q?Torbj=C3=B6rn_SVENSSON?= <torbjorn.svensson@foss.st.com> Cc: =?utf-8?q?Torbj=C3=B6rn_SVENSSON?= <torbjorn.svensson@foss.st.com>, aoliva@gcc.gnu.org Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1743497393331708244?= X-GMAIL-MSGID: =?utf-8?q?1743497393331708244?= |
Series |
testsuite: gluefile file need to be prefixed
|
|
Commit Message
Torbjorn SVENSSON
Sept. 9, 2022, 1:03 p.m. UTC
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.
Co-Authored-By: Yvan ROUX <yvan.roux@foss.st.com>
Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
---
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(-)
Comments
Torbjörn SVENSSON via Gcc-patches <gcc-patches@gcc.gnu.org> 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] != "" && [info exists gluefile] } { lappend options "libs=${gluefile}" lappend options "ldflags=${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 <yvan.roux@foss.st.com> > Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com> > --- > 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 > > - if { [target_info needs_status_wrapper] != "" && [info exists gluefile] } { > - lappend options "libs=${gluefile}" > - lappend options "ldflags=${wrap_flags}" > - } > - > global TEST_EXTRA_LIBS > if [info exists TEST_EXTRA_LIBS] { > lappend options "ldflags=$TEST_EXTRA_LIBS" > @@ -333,6 +328,11 @@ proc g++_target_compile { source dest type options } { > > set options [dg-additional-files-options $options $source] > > + if { [target_info needs_status_wrapper] != "" && [info exists gluefile] } { > + lappend options "libs=${gluefile}" > + lappend options "ldflags=${wrap_flags}" > + } > + > set result [target_compile $source $dest $type $options] > > 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 > > - if {[target_info needs_status_wrapper] != "" && \ > - [target_info needs_status_wrapper] != "0" && \ > - [info exists gluefile] } { > - lappend options "libs=${gluefile}" > - lappend options "ldflags=$wrap_flags" > - if { $type == "executable" } { > - set options [concat "{additional_flags=-dumpbase \"\"}" $options] > - } > - } > - > global TEST_EXTRA_LIBS > if [info exists TEST_EXTRA_LIBS] { > lappend options "ldflags=$TEST_EXTRA_LIBS" > @@ -170,6 +160,17 @@ proc gcc_target_compile { source dest type options } { > lappend options "timeout=[timeout_value]" > lappend options "compiler=$GCC_UNDER_TEST" > set options [dg-additional-files-options $options $source] > + > + if {[target_info needs_status_wrapper] != "" && \ > + [target_info needs_status_wrapper] != "0" && \ > + [info exists gluefile] } { > + lappend options "libs=${gluefile}" > + lappend options "ldflags=$wrap_flags" > + if { $type == "executable" } { > + set options [concat "{additional_flags=-dumpbase \"\"}" $options] > + } > + } > + > set return_val [target_compile $source $dest $type $options] > > 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. > > proc ${tool}_maybe_build_wrapper { filename args } { > - global gluefile wrap_flags > + global gluefile wrap_flags gcc_adjusted_linker_flags > > if { [target_info needs_status_wrapper] != "" \ > && [target_info needs_status_wrapper] != "0" \ > @@ -43,6 +43,11 @@ proc ${tool}_maybe_build_wrapper { filename args } { > if { $result != "" } { > 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 > + } > } > } > }
Hi Richard, On Mon, Sep 12, 2022 at 12:56:52PM +0100, Richard Sandiford via Gcc-patches wrote: > Torbjörn SVENSSON via Gcc-patches <gcc-patches@gcc.gnu.org> 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] != "" && [info exists gluefile] } { > lappend options "libs=${gluefile}" > lappend options "ldflags=${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? The issue is that dg-additional-files-options/gcc_adjusted_linker_flags add the "-Wl," prefix to the content of the global variable <gluefile> and not to the one of <option>, thus if this chunk of code is placed beforei, <options> is already populated with "libs=$gluefile" and lacks the prefix. Notice that this is the case only for the first test compiled in a tested .exp file, the next ones will have the adjusted gluefile content. For -T, this is another issue not covered by this patch, it is not handled by <gcc_adjust_linker_flags_list> like "-Xlinker" thus a "-Wl," prefix is placed between -T and the linker file, we'll send another patch to fix that issue. Thanks, Yvan > Thanks, > Richard > > > Co-Authored-By: Yvan ROUX <yvan.roux@foss.st.com> > > Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com> > > --- > > 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 > > > > - if { [target_info needs_status_wrapper] != "" && [info exists gluefile] } { > > - lappend options "libs=${gluefile}" > > - lappend options "ldflags=${wrap_flags}" > > - } > > - > > global TEST_EXTRA_LIBS > > if [info exists TEST_EXTRA_LIBS] { > > lappend options "ldflags=$TEST_EXTRA_LIBS" > > @@ -333,6 +328,11 @@ proc g++_target_compile { source dest type options } { > > > > set options [dg-additional-files-options $options $source] > > > > + if { [target_info needs_status_wrapper] != "" && [info exists gluefile] } { > > + lappend options "libs=${gluefile}" > > + lappend options "ldflags=${wrap_flags}" > > + } > > + > > set result [target_compile $source $dest $type $options] > > > > 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 > > > > - if {[target_info needs_status_wrapper] != "" && \ > > - [target_info needs_status_wrapper] != "0" && \ > > - [info exists gluefile] } { > > - lappend options "libs=${gluefile}" > > - lappend options "ldflags=$wrap_flags" > > - if { $type == "executable" } { > > - set options [concat "{additional_flags=-dumpbase \"\"}" $options] > > - } > > - } > > - > > global TEST_EXTRA_LIBS > > if [info exists TEST_EXTRA_LIBS] { > > lappend options "ldflags=$TEST_EXTRA_LIBS" > > @@ -170,6 +160,17 @@ proc gcc_target_compile { source dest type options } { > > lappend options "timeout=[timeout_value]" > > lappend options "compiler=$GCC_UNDER_TEST" > > set options [dg-additional-files-options $options $source] > > + > > + if {[target_info needs_status_wrapper] != "" && \ > > + [target_info needs_status_wrapper] != "0" && \ > > + [info exists gluefile] } { > > + lappend options "libs=${gluefile}" > > + lappend options "ldflags=$wrap_flags" > > + if { $type == "executable" } { > > + set options [concat "{additional_flags=-dumpbase \"\"}" $options] > > + } > > + } > > + > > set return_val [target_compile $source $dest $type $options] > > > > 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. > > > > proc ${tool}_maybe_build_wrapper { filename args } { > > - global gluefile wrap_flags > > + global gluefile wrap_flags gcc_adjusted_linker_flags > > > > if { [target_info needs_status_wrapper] != "" \ > > && [target_info needs_status_wrapper] != "0" \ > > @@ -43,6 +43,11 @@ proc ${tool}_maybe_build_wrapper { filename args } { > > if { $result != "" } { > > 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 > > + } > > } > > } > > }
Yvan Roux <yvan.roux@foss.st.com> writes: > Hi Richard, > On Mon, Sep 12, 2022 at 12:56:52PM +0100, Richard Sandiford via Gcc-patches wrote: >> Torbjörn SVENSSON via Gcc-patches <gcc-patches@gcc.gnu.org> 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] != "" && [info exists gluefile] } { >> lappend options "libs=${gluefile}" >> lappend options "ldflags=${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? > > The issue is that dg-additional-files-options/gcc_adjusted_linker_flags > add the "-Wl," prefix to the content of the global variable <gluefile> > and not to the one of <option>, thus if this chunk of code is placed > beforei, <options> is already populated with "libs=$gluefile" and lacks > the prefix. Notice that this is the case only for the first test > compiled in a tested .exp file, the next ones will have the adjusted > gluefile content. > > For -T, this is another issue not covered by this patch, it is not > handled by <gcc_adjust_linker_flags_list> like "-Xlinker" thus a "-Wl," > prefix is placed between -T and the linker file, we'll send another > patch to fix that issue. Ah, OK, I thought the patch was fixing the -T issue too. If it's just fixing the ordering problem then it all makes sense. :-) So yeah, the patch is OK for trunk, thanks. Please follow the instructions on https://gcc.gnu.org/gitwrite.html to get write access (listing me as sponsor), but I can commit it for you if you prefer. Richard > > Thanks, > Yvan > >> Thanks, >> Richard >> >> > Co-Authored-By: Yvan ROUX <yvan.roux@foss.st.com> >> > Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com> >> > --- >> > 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 >> > >> > - if { [target_info needs_status_wrapper] != "" && [info exists gluefile] } { >> > - lappend options "libs=${gluefile}" >> > - lappend options "ldflags=${wrap_flags}" >> > - } >> > - >> > global TEST_EXTRA_LIBS >> > if [info exists TEST_EXTRA_LIBS] { >> > lappend options "ldflags=$TEST_EXTRA_LIBS" >> > @@ -333,6 +328,11 @@ proc g++_target_compile { source dest type options } { >> > >> > set options [dg-additional-files-options $options $source] >> > >> > + if { [target_info needs_status_wrapper] != "" && [info exists gluefile] } { >> > + lappend options "libs=${gluefile}" >> > + lappend options "ldflags=${wrap_flags}" >> > + } >> > + >> > set result [target_compile $source $dest $type $options] >> > >> > 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 >> > >> > - if {[target_info needs_status_wrapper] != "" && \ >> > - [target_info needs_status_wrapper] != "0" && \ >> > - [info exists gluefile] } { >> > - lappend options "libs=${gluefile}" >> > - lappend options "ldflags=$wrap_flags" >> > - if { $type == "executable" } { >> > - set options [concat "{additional_flags=-dumpbase \"\"}" $options] >> > - } >> > - } >> > - >> > global TEST_EXTRA_LIBS >> > if [info exists TEST_EXTRA_LIBS] { >> > lappend options "ldflags=$TEST_EXTRA_LIBS" >> > @@ -170,6 +160,17 @@ proc gcc_target_compile { source dest type options } { >> > lappend options "timeout=[timeout_value]" >> > lappend options "compiler=$GCC_UNDER_TEST" >> > set options [dg-additional-files-options $options $source] >> > + >> > + if {[target_info needs_status_wrapper] != "" && \ >> > + [target_info needs_status_wrapper] != "0" && \ >> > + [info exists gluefile] } { >> > + lappend options "libs=${gluefile}" >> > + lappend options "ldflags=$wrap_flags" >> > + if { $type == "executable" } { >> > + set options [concat "{additional_flags=-dumpbase \"\"}" $options] >> > + } >> > + } >> > + >> > set return_val [target_compile $source $dest $type $options] >> > >> > 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. >> > >> > proc ${tool}_maybe_build_wrapper { filename args } { >> > - global gluefile wrap_flags >> > + global gluefile wrap_flags gcc_adjusted_linker_flags >> > >> > if { [target_info needs_status_wrapper] != "" \ >> > && [target_info needs_status_wrapper] != "0" \ >> > @@ -43,6 +43,11 @@ proc ${tool}_maybe_build_wrapper { filename args } { >> > if { $result != "" } { >> > 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 >> > + } >> > } >> > } >> > }
On Mon, Sep 12, 2022 at 05:09:57PM +0100, Richard Sandiford wrote: > Yvan Roux <yvan.roux@foss.st.com> writes: > > Hi Richard, > > On Mon, Sep 12, 2022 at 12:56:52PM +0100, Richard Sandiford via Gcc-patches wrote: > >> Torbjörn SVENSSON via Gcc-patches <gcc-patches@gcc.gnu.org> 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] != "" && [info exists gluefile] } { > >> lappend options "libs=${gluefile}" > >> lappend options "ldflags=${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? > > > > The issue is that dg-additional-files-options/gcc_adjusted_linker_flags > > add the "-Wl," prefix to the content of the global variable <gluefile> > > and not to the one of <option>, thus if this chunk of code is placed > > beforei, <options> is already populated with "libs=$gluefile" and lacks > > the prefix. Notice that this is the case only for the first test > > compiled in a tested .exp file, the next ones will have the adjusted > > gluefile content. > > > > For -T, this is another issue not covered by this patch, it is not > > handled by <gcc_adjust_linker_flags_list> like "-Xlinker" thus a "-Wl," > > prefix is placed between -T and the linker file, we'll send another > > patch to fix that issue. > > Ah, OK, I thought the patch was fixing the -T issue too. > If it's just fixing the ordering problem then it all makes sense. :-) > > So yeah, the patch is OK for trunk, thanks. Please follow the > instructions on https://gcc.gnu.org/gitwrite.html to get write access > (listing me as sponsor), but I can commit it for you if you prefer. > > Richard Thanks Richard, I've GCC write access, even if I didn't work on it for several years, I'll try to commit it myself tomorrow to check if it still works ;) but maybe Torbjorn would need a sponsorship for write access. Cheers, Yvan > > > > Thanks, > > Yvan > > > >> Thanks, > >> Richard > >> > >> > Co-Authored-By: Yvan ROUX <yvan.roux@foss.st.com> > >> > Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com> > >> > --- > >> > 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 > >> > > >> > - if { [target_info needs_status_wrapper] != "" && [info exists gluefile] } { > >> > - lappend options "libs=${gluefile}" > >> > - lappend options "ldflags=${wrap_flags}" > >> > - } > >> > - > >> > global TEST_EXTRA_LIBS > >> > if [info exists TEST_EXTRA_LIBS] { > >> > lappend options "ldflags=$TEST_EXTRA_LIBS" > >> > @@ -333,6 +328,11 @@ proc g++_target_compile { source dest type options } { > >> > > >> > set options [dg-additional-files-options $options $source] > >> > > >> > + if { [target_info needs_status_wrapper] != "" && [info exists gluefile] } { > >> > + lappend options "libs=${gluefile}" > >> > + lappend options "ldflags=${wrap_flags}" > >> > + } > >> > + > >> > set result [target_compile $source $dest $type $options] > >> > > >> > 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 > >> > > >> > - if {[target_info needs_status_wrapper] != "" && \ > >> > - [target_info needs_status_wrapper] != "0" && \ > >> > - [info exists gluefile] } { > >> > - lappend options "libs=${gluefile}" > >> > - lappend options "ldflags=$wrap_flags" > >> > - if { $type == "executable" } { > >> > - set options [concat "{additional_flags=-dumpbase \"\"}" $options] > >> > - } > >> > - } > >> > - > >> > global TEST_EXTRA_LIBS > >> > if [info exists TEST_EXTRA_LIBS] { > >> > lappend options "ldflags=$TEST_EXTRA_LIBS" > >> > @@ -170,6 +160,17 @@ proc gcc_target_compile { source dest type options } { > >> > lappend options "timeout=[timeout_value]" > >> > lappend options "compiler=$GCC_UNDER_TEST" > >> > set options [dg-additional-files-options $options $source] > >> > + > >> > + if {[target_info needs_status_wrapper] != "" && \ > >> > + [target_info needs_status_wrapper] != "0" && \ > >> > + [info exists gluefile] } { > >> > + lappend options "libs=${gluefile}" > >> > + lappend options "ldflags=$wrap_flags" > >> > + if { $type == "executable" } { > >> > + set options [concat "{additional_flags=-dumpbase \"\"}" $options] > >> > + } > >> > + } > >> > + > >> > set return_val [target_compile $source $dest $type $options] > >> > > >> > 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. > >> > > >> > proc ${tool}_maybe_build_wrapper { filename args } { > >> > - global gluefile wrap_flags > >> > + global gluefile wrap_flags gcc_adjusted_linker_flags > >> > > >> > if { [target_info needs_status_wrapper] != "" \ > >> > && [target_info needs_status_wrapper] != "0" \ > >> > @@ -43,6 +43,11 @@ proc ${tool}_maybe_build_wrapper { filename args } { > >> > if { $result != "" } { > >> > 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 > >> > + } > >> > } > >> > } > >> > }
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 - if { [target_info needs_status_wrapper] != "" && [info exists gluefile] } { - lappend options "libs=${gluefile}" - lappend options "ldflags=${wrap_flags}" - } - global TEST_EXTRA_LIBS if [info exists TEST_EXTRA_LIBS] { lappend options "ldflags=$TEST_EXTRA_LIBS" @@ -333,6 +328,11 @@ proc g++_target_compile { source dest type options } { set options [dg-additional-files-options $options $source] + if { [target_info needs_status_wrapper] != "" && [info exists gluefile] } { + lappend options "libs=${gluefile}" + lappend options "ldflags=${wrap_flags}" + } + set result [target_compile $source $dest $type $options] 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 - if {[target_info needs_status_wrapper] != "" && \ - [target_info needs_status_wrapper] != "0" && \ - [info exists gluefile] } { - lappend options "libs=${gluefile}" - lappend options "ldflags=$wrap_flags" - if { $type == "executable" } { - set options [concat "{additional_flags=-dumpbase \"\"}" $options] - } - } - global TEST_EXTRA_LIBS if [info exists TEST_EXTRA_LIBS] { lappend options "ldflags=$TEST_EXTRA_LIBS" @@ -170,6 +160,17 @@ proc gcc_target_compile { source dest type options } { lappend options "timeout=[timeout_value]" lappend options "compiler=$GCC_UNDER_TEST" set options [dg-additional-files-options $options $source] + + if {[target_info needs_status_wrapper] != "" && \ + [target_info needs_status_wrapper] != "0" && \ + [info exists gluefile] } { + lappend options "libs=${gluefile}" + lappend options "ldflags=$wrap_flags" + if { $type == "executable" } { + set options [concat "{additional_flags=-dumpbase \"\"}" $options] + } + } + set return_val [target_compile $source $dest $type $options] 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. proc ${tool}_maybe_build_wrapper { filename args } { - global gluefile wrap_flags + global gluefile wrap_flags gcc_adjusted_linker_flags if { [target_info needs_status_wrapper] != "" \ && [target_info needs_status_wrapper] != "0" \ @@ -43,6 +43,11 @@ proc ${tool}_maybe_build_wrapper { filename args } { if { $result != "" } { 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 + } } } }