From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from xry111.site (xry111.site [IPv6:2001:470:683e::1]) by sourceware.org (Postfix) with ESMTPS id 60970385E010 for ; Thu, 20 Jul 2023 13:29:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 60970385E010 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=xry111.site Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=xry111.site DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xry111.site; s=default; t=1689859761; bh=SUXXXufAnFvcqFeszsLpUl1s4iNsFwkO7cpvYdw8IIQ=; h=From:To:Cc:Subject:Date:From; b=NN8DHAQKBUDqjPP8YQkyFbAzKxyLbgZ5kaQLGz3zMttYxvfKkWnUyoLuo2M6nguvV Ctt5WFy3kAYd90r8Y9uOZdd8mP3JlpiSFB+kk/bxeqotT49pbrUFIab64d7Bs4AEBL US/ISo6ES0mnLsVturjth6jkKNAGlt9fCcnh4bGE= 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) From: Xi Ruoyao To: gcc-patches@gcc.gnu.org Cc: Lulu Cheng , WANG Xuerui , Xi Ruoyao 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 List-Id: 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(-) 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}" \ -- 2.41.0