Message ID | 20230720132910.210043-1-xry111@xry111.site |
---|---|
State | Accepted |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp3119840vqt; Thu, 20 Jul 2023 06:30:43 -0700 (PDT) X-Google-Smtp-Source: APBJJlHXPlvJwL+AxljvqviTyIoqamDgoFOwFM8/OdR7Uui7bImsSWfnQKuCVOqG65wt7RwBhOBI X-Received: by 2002:a17:906:c047:b0:993:f996:52d5 with SMTP id bm7-20020a170906c04700b00993f99652d5mr4375440ejb.25.1689859843490; Thu, 20 Jul 2023 06:30:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689859843; cv=none; d=google.com; s=arc-20160816; b=p60k7wzfOndT+45jNE8VWkrn6PVo+nXOQ6uKKNbQWAUEZBb+cliDvfw9i3CxNms8Ew FiQkLdTbUp5OZdCSMjLJuwOgjq5Gid4bwDl22othCuUi77gnptaBXrUPDDOtAKuPBV5b zxg39bVqgtNk5sLimCDmmbePVslCDPeST7T9sxk3rxOxb2Xfd0HpsADbirRcizUsFlbu ih2hU02xc3OLZEj/ilLPUP6A4V/15PQrNomOnoYOafg19SZxPWjOVB0Vd/5lssXEQvwe EQ7grAh75BAU7z9CgOpUJJISc5bGSMc4q+lLv54gjOCDWuC2QYTI3gGy+jTjVBDxlEgC j9VQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc :to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=rd5eo1EYa5ZP1XpTJjQuo/XzI+30C8uzY4d4QiNL7fc=; fh=Wp9KouHJNZKGMaTJBJCaCXSdVbfArzNXrrs+Ccrp9fk=; b=0zx4QJ+/oYtggIR/iFuqg8oaroefZtMtSc+E47eLHjqilubqr0JKR8dnrd6ZfGNhQi ATWsOQ6626VmZDlRI/LtLA1fXJBF/wBatuI/Em/CQdaa3rzYXozNaxu1QhBUXRzlVbw/ qBbmLFDzrvldXpKf967LLS2W2vL4YjAyEdfVXrI7e1bd9mwXbyj0Vb+nix/WmttBphfH jXXsDzZv6Nss0bUT0NXNIWNIZz7cGdVM13QuKp651dqtZOXfdIll9Fc8iBlgsNZum9BI qztQQu+0qVnjhGnSkpFp/jyYtMiZKiDC22tOqYdqqd1pzTFafHIRbW5shSsT4ES/+kcS YyWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=ePDGRYJr; 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 (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id i11-20020a17090639cb00b00988f21df36esi661038eje.594.2023.07.20.06.30.43 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jul 2023 06:30:43 -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=ePDGRYJr; 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 2EC603857022 for <ouuuleilei@gmail.com>; Thu, 20 Jul 2023 13:30:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2EC603857022 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1689859828; bh=rd5eo1EYa5ZP1XpTJjQuo/XzI+30C8uzY4d4QiNL7fc=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=ePDGRYJr0Z7oVg2EnHE8NYfyAwvsM7NfgOPwfhTgG0NH2nc0qxMWBIEC69PW1jxPW pLKlLB3PqkUyF9XppPuv4Uug8Yo+W+wxlkI+NokDAahRpDLeqF+xWTWeAm99ysQCf3 uha5ZVIbQekTQBu7VrurCQQ9XbujU0NnuBNr2l/E= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from xry111.site (xry111.site [IPv6:2001:470:683e::1]) by sourceware.org (Postfix) with ESMTPS id 60970385E010 for <gcc-patches@gcc.gnu.org>; Thu, 20 Jul 2023 13:29:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 60970385E010 Received: from stargazer.. (unknown [115.155.1.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) (Authenticated sender: xry111@xry111.site) by xry111.site (Postfix) with ESMTPSA id 5CF316599C; Thu, 20 Jul 2023 09:29:20 -0400 (EDT) To: gcc-patches@gcc.gnu.org Cc: Lulu Cheng <chenglulu@loongson.cn>, WANG Xuerui <i@xen0n.name>, Xi Ruoyao <xry111@xry111.site> Subject: [PATCH] LoongArch: Allow using --with-arch=native if host CPU is LoongArch Date: Thu, 20 Jul 2023 21:28:02 +0800 Message-ID: <20230720132910.210043-1-xry111@xry111.site> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, LIKELY_SPAM_FROM, RCVD_IN_BARRACUDACENTRAL, SPF_HELO_PASS, 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: Xi Ruoyao via Gcc-patches <gcc-patches@gcc.gnu.org> Reply-To: Xi Ruoyao <xry111@xry111.site> 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: INBOX X-GMAIL-THRID: 1771946475097208444 X-GMAIL-MSGID: 1771946475097208444 |
Series |
LoongArch: Allow using --with-arch=native if host CPU is LoongArch
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | success | Github commit url |
Commit Message
Xi Ruoyao
July 20, 2023, 1:28 p.m. UTC
If the host triple and the target triple are different but the host is LoongArch, in some cases --with-arch=native can be useful. For example, if we are bootstrapping a loongarch64-linux-musl toolchain on a Glibc-based system and we don't intend to use the toolchain on other machines, we can use ../gcc/configure --{build,host}=loongarch64-linux-gnu \ --target=loongarch64-linux-musl --with-arch=native Relax the check in config.gcc to allow such configurations. gcc/ChangeLog: * config.gcc [target=loongarch*-*-*, with_arch=native]: Allow building cross compiler if the host CPU is LoongArch. --- Tested on x86_64-linux-gnu (building a cross compiler targeting LoongArch --with-arch=native still rejected) and loongarch64-linux-gnu (building a cross compiler targeting loongarch64-linux-musl allowed). Ok for trunk? gcc/config.gcc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
Comments
在 2023/7/20 下午9:28, Xi Ruoyao 写道: > If the host triple and the target triple are different but the host is > LoongArch, in some cases --with-arch=native can be useful. For example, > if we are bootstrapping a loongarch64-linux-musl toolchain on a > Glibc-based system and we don't intend to use the toolchain on other > machines, we can use > > ../gcc/configure --{build,host}=loongarch64-linux-gnu \ > --target=loongarch64-linux-musl --with-arch=native > > Relax the check in config.gcc to allow such configurations. > > gcc/ChangeLog: > > * config.gcc [target=loongarch*-*-*, with_arch=native]: Allow > building cross compiler if the host CPU is LoongArch. > --- > > Tested on x86_64-linux-gnu (building a cross compiler targeting > LoongArch --with-arch=native still rejected) and loongarch64-linux-gnu > (building a cross compiler targeting loongarch64-linux-musl allowed). > Ok for trunk? Hi, Ruoyao: I'm sorry that some things at home are late, can this usage scenario be described in detail? I didn't really understand that. > > gcc/config.gcc | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/gcc/config.gcc b/gcc/config.gcc > index 1446eb2b3ca..146bca22a38 100644 > --- a/gcc/config.gcc > +++ b/gcc/config.gcc > @@ -4939,10 +4939,13 @@ case "${target}" in > case ${with_arch} in > "" | loongarch64 | la464) ;; # OK, append here. > native) > - if test x${host} != x${target}; then > + case ${host} in > + loongarch*) ;; # OK > + *) > echo "--with-arch=native is illegal for cross-compiler." 1>&2 > exit 1 > - fi > + ;; > + esac > ;; > "") > echo "Please set a default value for \${with_arch}" \
diff --git a/gcc/config.gcc b/gcc/config.gcc index 1446eb2b3ca..146bca22a38 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -4939,10 +4939,13 @@ case "${target}" in case ${with_arch} in "" | loongarch64 | la464) ;; # OK, append here. native) - if test x${host} != x${target}; then + case ${host} in + loongarch*) ;; # OK + *) echo "--with-arch=native is illegal for cross-compiler." 1>&2 exit 1 - fi + ;; + esac ;; "") echo "Please set a default value for \${with_arch}" \