From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id CED7D3858D20 for ; Fri, 3 Feb 2023 12:28:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CED7D3858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id BC3404B3; Fri, 3 Feb 2023 04:29:35 -0800 (PST) Received: from localhost (e121540-lin.manchester.arm.com [10.32.99.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B8BF93FA32; Fri, 3 Feb 2023 04:28:52 -0800 (PST) From: Richard Sandiford To: YunQiang Su Mail-Followup-To: YunQiang Su ,gcc-patches@gcc.gnu.org, macro@orcam.me.uk, syq@debian.org, jiaxun.yang@flygoat.com, richard.sandiford@arm.com Cc: gcc-patches@gcc.gnu.org, macro@orcam.me.uk, syq@debian.org, jiaxun.yang@flygoat.com Subject: Re: [PATCH] MIPS: use arch_32/64 instead of default_mips_arch References: <20230203090544.2528175-1-yunqiang.su@cipunited.com> Date: Fri, 03 Feb 2023 12:28:51 +0000 In-Reply-To: <20230203090544.2528175-1-yunqiang.su@cipunited.com> (YunQiang Su's message of "Fri, 3 Feb 2023 17:05:44 +0800") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-36.0 required=5.0 tests=BAYES_00,GIT_PATCH_0,KAM_DMARC_NONE,KAM_DMARC_STATUS,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_NONE,SPF_NONE,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 List-Id: YunQiang Su writes: > The value of default_mips_arch will be always used for -march by default, > no matter what value is given to -mabi. > It will produce abnormal elf file like: > ELF 32-bit LSB relocatable, MIPS, MIPS64 rel2 version 1 (SYSV) Is that really wrong though? There's nothing in principle that prevents a 64-bit ISA being used with a 32-bit ABI, even in the object file's metadata. > So we use with_arch_32 and with_arch_64 instead of default_mips_arch > for all mipsisa[32,64]rN triples. I agree there's no benefit to using a stock MIPS64rN ISA over a stock MIPS32rN ISA with a 32-bit ABI, and the patch is only changing those cases. But things are different when using (say) MIPS4 with a 32-bit ABI, or a 64-bit processor that has proprietary extensions. And, for example, a mips-linux-gnu toolchain would (IIRC) require an -march as well as an -mabi in order to generate 64-bit code. There would be no implicit selection of a new -march. I'm not opposed to the patch. I just think we should be clear about the underlying principle. If it's just that all MIPS32/64rN toolchains should behave in the same way (like the sde and mti ones do), then the patch looks good. But I don't think we should create a general principle that -mabi determines/changes/downgrades -march. Thanks, Richard > > gcc/ChangeLog: > * config.gcc: use with_arch_32 and with_arch_64 instead of > default_mips_arch for mipsisa[32,64]rN triples. > --- > gcc/config.gcc | 21 ++++++++++++++------- > 1 file changed, 14 insertions(+), 7 deletions(-) > > diff --git a/gcc/config.gcc b/gcc/config.gcc > index f0958e1c959..0b6d093d847 100644 > --- a/gcc/config.gcc > +++ b/gcc/config.gcc > @@ -2518,13 +2518,16 @@ mips*-*-linux*) # Linux MIPS, either endian. > extra_options="${extra_options} linux-android.opt" > case ${target} in > mipsisa32r6*) > - default_mips_arch=mips32r6 > + with_arch_32="mips32r6" > + with_arch_64="mips64r6" > ;; > mipsisa32r2*) > - default_mips_arch=mips32r2 > + with_arch_32="mips32r2" > + with_arch_64="mips64r2" > ;; > mipsisa32*) > - default_mips_arch=mips32 > + with_arch_32="mips32" > + with_arch_64="mips64" > ;; > mips64el-st-linux-gnu) > default_mips_abi=n32 > @@ -2540,22 +2543,26 @@ mips*-*-linux*) # Linux MIPS, either endian. > ;; > mipsisa64r6*-*-linux-gnuabi64) > default_mips_abi=64 > - default_mips_arch=mips64r6 > + with_arch_32="mips32r6" > + with_arch_64="mips64r6" > enable_mips_multilibs="yes" > ;; > mipsisa64r6*-*-linux*) > default_mips_abi=n32 > - default_mips_arch=mips64r6 > + with_arch_32="mips32r6" > + with_arch_64="mips64r6" > enable_mips_multilibs="yes" > ;; > mipsisa64r2*-*-linux-gnuabi64) > default_mips_abi=64 > - default_mips_arch=mips64r2 > + with_arch_32="mips32r2" > + with_arch_64="mips64r2" > enable_mips_multilibs="yes" > ;; > mipsisa64r2*-*-linux*) > default_mips_abi=n32 > - default_mips_arch=mips64r2 > + with_arch_32="mips32r2" > + with_arch_64="mips64r2" > enable_mips_multilibs="yes" > ;; > mips64*-*-linux-gnuabi64 | mipsisa64*-*-linux-gnuabi64)