From patchwork Tue Sep 12 10:58:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 138095 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9ecd:0:b0:3f2:4152:657d with SMTP id t13csp321238vqx; Tue, 12 Sep 2023 03:59:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IESSU7ZXVPUc3LzEToEd6uuq6U6spqj4pvWUoknDgBQASO2Pt9aesOEQ/uHx8KspVuzNUAa X-Received: by 2002:a17:906:1050:b0:9a5:d876:c37 with SMTP id j16-20020a170906105000b009a5d8760c37mr10004296ejj.74.1694516380885; Tue, 12 Sep 2023 03:59:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694516380; cv=none; d=google.com; s=arc-20160816; b=MEKlGGrZwj4KiT9xSRikp4Lq3p+bNivI7J1vgZs2Hs3B/S8JWTM8oKLh8ogSqBqdXZ bZZNfr5wrRns1I2vw7gbpzgyuEJCGgSP3VqlKBgujg2q+QvHBCFgKaX5XXMNL/b4knrw 38F9/3OKcgE0pi7a6mwkfLmLaXG1G2ig4xGj5+eYZKVi2nFqWOk3mUtbOnvfy+3iyRr2 NiuwfPDxzvtbQqhtnQNWHS2newaBf2JESTsu9jWmRvW5dL1Btqk/rvCLXOD1JKhvUloK Lh3SGLNif5SukgNn7H2dPW+6SYS7vQmaImtGeWofaWk2XQWvrazr2sIbmKeeutQYkefb N4Gw== 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=nEUo66n8AVA4IkiWNF5rnwhhYqQ3/9J8sNCU6UpZakA=; fh=zkxDmoa/uFHYAdhLmDLeW+RWqN+ezny5DvhP/qnjfec=; b=KCOB49R0x++HkyEU1+DKL75DsAOa17YXXdH4PsoKPZN/HTfwLNus/PwO4e1+YSjWvQ UVmu/i+xTvS56vVVfJF7ma1YjOR8sND9UnMjXyGL+qx/3SWvZT5ijdoXdUzFAaAeOmqe sxs49V7SNfzOR5AlBvchNdWIK5bbAQonw2cbgQgRMn8ygczEEEEhZLmOUJkRLRgSYeWq MUIJfNG+EYbPIxMPPYZwsZwWDwxDLYGeyH/HiMdW6SkzyH5AD0TGpi6Dkuit2Puo77J0 afdsuoh4fxB3SYJFGuAdGBimooXT3Ive3q7Te1gk3V3HO6yqr2+Q8XQO40MNvjVL4yJs tGzg== 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 z20-20020a170906241400b0099367afd642si7982732eja.66.2023.09.12.03.59.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 03:59:40 -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 1DAAF385781F for ; Tue, 12 Sep 2023 10:59:23 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa2.mentor.iphmx.com (esa2.mentor.iphmx.com [68.232.141.98]) by sourceware.org (Postfix) with ESMTPS id 383393858409 for ; Tue, 12 Sep 2023 10:58:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 383393858409 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: 7fcmkt2hSL+DXEhGMsTDaQ== X-CSE-MsgGUID: JQuHIsORRqKDOhfK39KBqw== X-IronPort-AV: E=Sophos;i="6.02,139,1688457600"; d="scan'208,223";a="18677484" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa2.mentor.iphmx.com with ESMTP; 12 Sep 2023 02:58:46 -0800 IronPort-SDR: Ef56AOWse0lLNumfeRyXBYz6Gse/vOil434nc9jLZ+kJ1koZ7A1wBPL2pWy8cqlHPAyO3axrkC zifToGBYI8d/XVTM13Np26AOgNZgnRs6v0ebB6JQ1FnVAxQc/dwKSSAe6EQ+B/ya88gvVtO7dT NEzq88e4lml5LwtI/aaIi1NjNdmw8eOkzRYwNJhsB4QYWWeDoAdPMcUEYTmggI/78IvI9HaSIm g6oIxeqg4H1L274+50gNrEVpbefzc4aCvc98Ncv5NN7zUpYU4lICQGLlGRLQkTwt1jdQT/MueX ccU= From: Thomas Schwinge To: Subject: libffi: Consider '--with-build-sysroot=[...]' for target libraries' build-tree testing (instead of build-time 'CC' etc.) [PR109951] (was: [PATCH v5 GCC] libffi/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 12:58:27 +0200 Message-ID: <871qf3zmi4.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.7 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, KAM_LOTSOFHASH, 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 , libffi-discuss@sourceware.org, "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: 1776829208868802986 X-GMAIL-MSGID: 1776829208868802986 Hi! On 2020-04-20T14:18:40+0100, "Maciej W. Rozycki via Gcc-patches" wrote: > Fix a problem with the libffi 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 > inability to actually choose any compiler at all in a cross-compilation > configuration. This has since, as far as I can tell, been resolved properly by H.J. Lu's GCC commit 5be7b66998127286fada45e4f23bd8a2056d553e, "libffi: Integrate build with GCC", and GCC commit 4824ed41ba7cd63e60fd9f8769a58b79935a90d1 "libffi: Integrate testsuite with GCC testsuite". > Address this problem by providing a DejaGNU configuration file defining > the compiler to use, via the CC_FOR_TARGET TCL variable, set from $CC 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 GCC libffi 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 the attached "libffi: Consider '--with-build-sysroot=[...]' for target libraries' build-tree testing (instead of build-time 'CC' etc.) [PR109951]"? 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 8b8654d04dcbb7f0a5947bc21efc5b9c60b3b6c6 Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Mon, 11 Sep 2023 10:50:00 +0200 Subject: [PATCH] libffi: 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 a0b48358cb1e70e161a87ec5deb7a4b25defba6b "libffi/test: Fix compilation for build sysroot" done differently, avoiding build-tree testing use of any random gunk that may appear in build-time 'CC', 'CXX'. PR testsuite/109951 libffi/ * configure.ac: 'AC_SUBST(SYSROOT_CFLAGS_FOR_TARGET)'. : Don't set 'CC_FOR_TARGET', 'CXX_FOR_TARGET', instead set 'SYSROOT_CFLAGS_FOR_TARGET'. * Makefile.in: Regenerate. * configure: Likewise. * include/Makefile.in: Likewise. * man/Makefile.in: Likewise. * testsuite/Makefile.in: Likewise. * testsuite/lib/libffi.exp (libffi_target_compile): If '--with-build-sysroot=[...]' was specified, use it for build-tree testing. --- libffi/Makefile.in | 1 + libffi/configure | 10 ++++++---- libffi/configure.ac | 5 +++-- libffi/include/Makefile.in | 1 + libffi/man/Makefile.in | 1 + libffi/testsuite/Makefile.in | 1 + libffi/testsuite/lib/libffi.exp | 7 +++++++ 7 files changed, 20 insertions(+), 6 deletions(-) diff --git a/libffi/Makefile.in b/libffi/Makefile.in index 1d936b5c8a5..3a55212cc00 100644 --- a/libffi/Makefile.in +++ b/libffi/Makefile.in @@ -383,6 +383,7 @@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ +SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@ TARGET = @TARGET@ TARGETDIR = @TARGETDIR@ TARGET_OBJ = @TARGET_OBJ@ diff --git a/libffi/configure b/libffi/configure index 9eac9c907bf..f1efd6987a3 100755 --- a/libffi/configure +++ b/libffi/configure @@ -666,6 +666,7 @@ TESTSUBDIR_TRUE MAINT MAINTAINER_MODE_FALSE MAINTAINER_MODE_TRUE +SYSROOT_CFLAGS_FOR_TARGET READELF CXXCPP CPP @@ -11634,7 +11635,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11637 "configure" +#line 11638 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11740,7 +11741,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11743 "configure" +#line 11744 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -15137,9 +15138,10 @@ _ACEOF + + cat > local.exp < local.exp <