From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by sourceware.org (Postfix) with ESMTP id 924D33858CDA for ; Sat, 22 Jul 2023 09:11:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 924D33858CDA Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=loongson.cn Received: from loongson.cn (unknown [112.8.56.102]) by gateway (Coremail) with SMTP id _____8DxxPBNnbtk_TAIAA--.21213S3; Sat, 22 Jul 2023 17:11:41 +0800 (CST) Received: from [192.168.0.107] (unknown [112.8.56.102]) by localhost.localdomain (Coremail) with SMTP id AQAAf8Ax98xNnbtksYw2AA--.64609S3; Sat, 22 Jul 2023 17:11:41 +0800 (CST) Subject: Re: [PATCH] LoongArch: Allow using --with-arch=native if host CPU is LoongArch To: Xi Ruoyao , gcc-patches@gcc.gnu.org References: <20230720132910.210043-1-xry111@xry111.site> From: chenglulu Message-ID: <05cd8cd3-81f1-75d8-2460-618c1c1521ce@loongson.cn> Date: Sat, 22 Jul 2023 17:11:40 +0800 User-Agent: Mozilla/5.0 (X11; Linux loongarch64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20230720132910.210043-1-xry111@xry111.site> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-CM-TRANSID:AQAAf8Ax98xNnbtksYw2AA--.64609S3 X-CM-SenderInfo: xfkh0wpoxo3qxorr0wxvrqhubq/ X-Coremail-Antispam: 1Uk129KBj93XoW7WFWkGF4xZr45uw1DKF17Arc_yoW8Ww1Dp3 sIvas8JF48XrWrKa17K34rWwn8Jrn7GF15WF4rt34UZr98Zry293sIgw13GFyDAasYgr12 gF48Gw1qv3WYyagCm3ZEXasCq-sJn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU 0xBIdaVrnRJUUUvYb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2 IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_JFI_Gr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI 0_Jr0_Gr1l84ACjcxK6I8E87Iv67AKxVWxJVW8Jr1l84ACjcxK6I8E87Iv6xkF7I0E14v2 6r4j6r4UJwAS0I0E0xvYzxvE52x082IY62kv0487Mc804VCY07AIYIkI8VC2zVCFFI0UMc 02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2IY67AKxVWUXVWUAwAv7VC2z280aVAF wI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcVAKI48JMxk0xIA0c2IEe2xFo4 CEbIxvr21l42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG 67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r1Y6r17MI IYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E 14v26r1j6r4UMIIF0xvE42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVWUJV W8JwCI42IY6I8E87Iv6xkF7I0E14v26r1j6r4UYxBIdaVFxhVjvjDU0xZFpf9x07UNvtZU UUUU= X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00,GIT_PATCH_0,KAM_DMARC_STATUS,NICE_REPLY_A,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 List-Id: 在 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}" \