From patchwork Tue Sep 12 11:16:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 138102 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9ecd:0:b0:3f2:4152:657d with SMTP id t13csp331360vqx; Tue, 12 Sep 2023 04:16:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHNdJF9A0X0eAmqRxoe/Vsb5Gr1XRX6gCV6zFnio674iIDNjZXi6GKqBHeOlXhlhbRIhPYf X-Received: by 2002:a17:906:846e:b0:9a6:6314:4437 with SMTP id hx14-20020a170906846e00b009a663144437mr9496525ejc.39.1694517418577; Tue, 12 Sep 2023 04:16:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694517418; cv=none; d=google.com; s=arc-20160816; b=InGBlYoz40utvgA5WFVTmbINEbAY/c4UGznXF2g98LyM/3G07KNMCHoax27HfVaV3L 1/GAL6zwhg15pSPimJr5H6nHlPiJsogO5LX/4VU4lTt4F0iA5feFgUL/jkMSCion+5aE UEixrfG8y98Ns8Pm3jkdw5X1KVB/5/9ZSqp9AXi+6zJR8DYfj32fUJQkspk7QthwkGKb K90PvI9BtTUZZUuPwCeZH58GJgBsaYxTNmLvg3wNkKnH7bNZAf2PGXi7fmbYZ1B9befR a7xZFtKD4OybRHFeaALVPLUFrFpQn+5H5d6zbmeC07FTIfVNjxLQmv0UXDKusvPSnIb/ YomQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mime-version:message-id:date :user-agent:references:in-reply-to:subject:to:from:ironport-sdr :dmarc-filter:delivered-to; bh=VqHaFOmy5aOy8PGKtBrjq4WssUkZXJP0GcOlJIWsPQw=; fh=m3Ze8XhDrS/Na/EtCP/Ugc63s3lGKxGqBg3t7zQuKo8=; b=C9T94DN9tLuk5DrscOqzYmvEc3Vz098+ZunwN+8o3AUiqsKcgl1lp6yXf/zaa0XVr0 VZ6FlRvNDvXfttdkpLvIlg+yq+D4Y2lnZkDEME4re05/Xxw6g1LBcEUVnxtprwQuudIf immWIGTJ7pf3qFkCu201T2/DIAWKnXG1gJOKHThwtKBHvcpfex1AzxIxTR6Akz35be3Z lgsxjerLzEkgYuMRaK4PYKx9AmaJOun8jqFlqsZETlksbkXVMOksfUJUw4vVzRNkyUtR 3S5rv0OXlXZWgEO65PG/SLsd3LHR7Mcw6DNJy+XDmOCIqbzsDyHQQuDdJnJEiXvuiPfe 5TKw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id jj27-20020a170907985b00b009a9e1e4e487si8535122ejc.88.2023.09.12.04.16.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 04:16:58 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 97EC73858C1F for ; Tue, 12 Sep 2023 11:16:51 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa3.mentor.iphmx.com (esa3.mentor.iphmx.com [68.232.137.180]) by sourceware.org (Postfix) with ESMTPS id 37B133858D3C for ; Tue, 12 Sep 2023 11:16:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 37B133858D3C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com X-CSE-ConnectionGUID: plnIDWAuSf2hXLzBkKlc0w== X-CSE-MsgGUID: BTajlRvHScy7s9/dW7VT2g== X-IronPort-AV: E=Sophos;i="6.02,139,1688457600"; d="scan'208,223";a="16699960" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa3.mentor.iphmx.com with ESMTP; 12 Sep 2023 03:16:24 -0800 IronPort-SDR: JvV7QDPe1ZNB4LC12foJLsETkJt9rXQfEbvN2xySME8rZHOMcRHFbD+5CggaBO00OOGXLaueMq yQjkGWpxbvWVtopq8jmyqez8IKIKxMBp737UA5aTDsZL47yLWFYTXgNrMJjkhjBcLiLy8a+ghA NnQefj3vYH5aAqQwwPlArD5NHue1kvjpFCK55rfz4w9GGS5/VgQB2DFS84+x6TqItJP+4AV15V AaWeqvyNTzeOeuBDPS199ivCB6dJxxVC3yJnVZnwNxi7P4SBq5kFjrcMN3YaXxApLsa+VWvG+m Kls= From: Thomas Schwinge To: , , "Ian Lance Taylor" Subject: libgo: Consider '--with-build-sysroot=[...]' for target libraries' build-tree testing (instead of build-time 'CC' etc.) [PR109951] (was: [PATCH 3/4] libgo/test: Fix compilation for build sysroot) In-Reply-To: References: User-Agent: Notmuch/0.29.3+94~g74c3f1b (https://notmuchmail.org) Emacs/28.2 (x86_64-pc-linux-gnu) Date: Tue, 12 Sep 2023 13:16:17 +0200 Message-ID: <87sf7jy73y.fsf@euler.schwinge.homeip.net> MIME-Version: 1.0 X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-14.mgc.mentorg.com (139.181.222.14) To svr-ies-mbx-10.mgc.mentorg.com (139.181.222.10) X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, KAM_SHORT, SPF_HELO_PASS, SPF_PASS, TXREP 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Iain Sandoe , "Maciej W. Rozycki" Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1776830297125484209 X-GMAIL-MSGID: 1776830297125484209 Hi! On 2019-11-11T18:12:44+0000, "Maciej W. Rozycki" wrote: > Fix a problem with the libgo testsuite using a method to determine the > compiler to use resulting in the tool being different from one the > library has been built with, and causing a catastrophic failure from the > lack of a suitable `--sysroot=' option where the `--with-build-sysroot=' > configuration option has been used to build the compiler resulting in > the inability to link executables. > > Address this problem by providing a DejaGNU configuration file defining > the compiler to use, via the GOC_UNDER_TEST TCL variable, set from $GOC > by autoconf, which will have all the required options set for the target > compiler to build executables in the environment configured As we've found, this is conceptually problematic, as discussed in "Consider '--with-build-sysroot=[...]' for target libraries' build-tree testing (instead of build-time 'CC' etc.) [PR109951]". I therefore suggest to apply to libgo the conceptually same changes as I've just pushed for libgomp: "libgomp: Consider '--with-build-sysroot=[...]' for target libraries' build-tree testing (instead of build-time 'CC' etc.) [PR91884, PR109951]". OK to push (via Ian/Go upstream) the attached "libgo: Consider '--with-build-sysroot=[...]' for target libraries' build-tree testing (instead of build-time 'CC' etc.) [PR109951]"? By the way, I've tested this one via hard-coding 'libgo/configure.ac:USE_DEJAGNU' to 'yes', and observing that my "quick hack to replicate the original requirement" ('internal_error ("MISSING SYSROOT");') no longer triggers. Grüße Thomas ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955 From 81a73112e3d0b43c240c7c9040c24d68c2739bf3 Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Mon, 11 Sep 2023 16:55:24 +0200 Subject: [PATCH] libgo: Consider '--with-build-sysroot=[...]' for target libraries' build-tree testing (instead of build-time 'CC' etc.) [PR109951] Similar to commit fb5d27be272b71fb9026224535fc73f125ce3be7 "libgomp: Consider '--with-build-sysroot=[...]' for target libraries' build-tree testing (instead of build-time 'CC' etc.) [PR91884, PR109951]", this is commit b72813a68c943643a6241418f27aa8b9d4614647 "libgo: fix DejaGNU testsuite compiler when using build sysroot" done differently, avoiding build-tree testing use of any random gunk that may appear in build-time 'GOC'. PR testsuite/109951 libgo/ * configure.ac: 'AC_SUBST(SYSROOT_CFLAGS_FOR_TARGET)'. * Makefile.in: Regenerate. * configure: Likewise. * testsuite/Makefile.in: Likewise. * testsuite/lib/libgo.exp (libgo_init): If '--with-build-sysroot=[...]' was specified, use it for build-tree testing. * testsuite/libgo-test-support.exp.in (GOC_UNDER_TEST): Don't set. (SYSROOT_CFLAGS_FOR_TARGET): Set. --- libgo/Makefile.in | 1 + libgo/configure | 7 +++++-- libgo/configure.ac | 2 ++ libgo/testsuite/Makefile.in | 1 + libgo/testsuite/lib/libgo.exp | 8 ++++++++ libgo/testsuite/libgo-test-support.exp.in | 2 +- 6 files changed, 18 insertions(+), 3 deletions(-) diff --git a/libgo/Makefile.in b/libgo/Makefile.in index 40340bfb7a5..8dcb6d6a354 100644 --- a/libgo/Makefile.in +++ b/libgo/Makefile.in @@ -474,6 +474,7 @@ SPLIT_STACK = @SPLIT_STACK@ STRINGOPS_FLAG = @STRINGOPS_FLAG@ STRIP = @STRIP@ STRUCT_EPOLL_EVENT_FD_OFFSET = @STRUCT_EPOLL_EVENT_FD_OFFSET@ +SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@ USE_DEJAGNU = @USE_DEJAGNU@ VERSION = @VERSION@ WARN_FLAGS = @WARN_FLAGS@ diff --git a/libgo/configure b/libgo/configure index a607dbff68e..2f1609b42b5 100755 --- a/libgo/configure +++ b/libgo/configure @@ -633,6 +633,7 @@ ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS +SYSROOT_CFLAGS_FOR_TARGET HAVE_STATIC_LINK_FALSE HAVE_STATIC_LINK_TRUE HAVE_STAT_TIMESPEC_FALSE @@ -11544,7 +11545,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11547 "configure" +#line 11548 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11650,7 +11651,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11653 "configure" +#line 11654 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -16147,6 +16148,8 @@ else fi + + cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure diff --git a/libgo/configure.ac b/libgo/configure.ac index a59aa091d1d..54c35c0903c 100644 --- a/libgo/configure.ac +++ b/libgo/configure.ac @@ -913,6 +913,8 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM(,)], LDFLAGS=$LDFLAGS_hold]) AM_CONDITIONAL(HAVE_STATIC_LINK, test "$libgo_cv_ld_static" = yes) +AC_SUBST(SYSROOT_CFLAGS_FOR_TARGET) + AC_CACHE_SAVE if test ${multilib} = yes; then diff --git a/libgo/testsuite/Makefile.in b/libgo/testsuite/Makefile.in index 7869265851c..7c2e2e62fcf 100644 --- a/libgo/testsuite/Makefile.in +++ b/libgo/testsuite/Makefile.in @@ -223,6 +223,7 @@ SPLIT_STACK = @SPLIT_STACK@ STRINGOPS_FLAG = @STRINGOPS_FLAG@ STRIP = @STRIP@ STRUCT_EPOLL_EVENT_FD_OFFSET = @STRUCT_EPOLL_EVENT_FD_OFFSET@ +SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@ USE_DEJAGNU = @USE_DEJAGNU@ VERSION = @VERSION@ WARN_FLAGS = @WARN_FLAGS@ diff --git a/libgo/testsuite/lib/libgo.exp b/libgo/testsuite/lib/libgo.exp index b5833bbafe2..638bf869602 100644 --- a/libgo/testsuite/lib/libgo.exp +++ b/libgo/testsuite/lib/libgo.exp @@ -53,5 +53,13 @@ load_gcc_lib timeout.exp load_gcc_lib go.exp proc libgo_init { args } { + global TESTING_IN_BUILD_TREE + if { [info exists TESTING_IN_BUILD_TREE] } { + # If '--with-build-sysroot=[...]' was specified, use it for build-tree + # testing. + global TEST_ALWAYS_FLAGS SYSROOT_CFLAGS_FOR_TARGET + set TEST_ALWAYS_FLAGS $SYSROOT_CFLAGS_FOR_TARGET + } + go_init $args } diff --git a/libgo/testsuite/libgo-test-support.exp.in b/libgo/testsuite/libgo-test-support.exp.in index aaa6c5ef91d..effd6f1caca 100644 --- a/libgo/testsuite/libgo-test-support.exp.in +++ b/libgo/testsuite/libgo-test-support.exp.in @@ -14,4 +14,4 @@ # along with GCC; see the file COPYING3. If not see # . -set GOC_UNDER_TEST {@GOC@} +set SYSROOT_CFLAGS_FOR_TARGET {@SYSROOT_CFLAGS_FOR_TARGET@} -- 2.34.1