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 1F1563858D33 for ; Wed, 19 Apr 2023 19:03:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1F1563858D33 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 A89DF1424; Wed, 19 Apr 2023 12:04:27 -0700 (PDT) Received: from localhost (e121540-lin.manchester.arm.com [10.32.110.72]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 03DE73F5A1; Wed, 19 Apr 2023 12:03:42 -0700 (PDT) From: Richard Sandiford To: YunQiang Su Mail-Followup-To: YunQiang Su ,binutils@sourceware.org, syq@debian.org, macro@orcam.me.uk, xry111@xry111.site, jiaxun.yang@flygoat.com, richard.sandiford@arm.com Cc: binutils@sourceware.org, syq@debian.org, macro@orcam.me.uk, xry111@xry111.site, jiaxun.yang@flygoat.com Subject: Re: [PATCH v4 2/2] MIPS: default output r6 obj if the triple is r6 References: <20230414072046.1639896-1-yunqiang.su@cipunited.com> <20230418140019.2195551-1-yunqiang.su@cipunited.com> <20230418140019.2195551-2-yunqiang.su@cipunited.com> Date: Wed, 19 Apr 2023 20:03:41 +0100 In-Reply-To: <20230418140019.2195551-2-yunqiang.su@cipunited.com> (YunQiang Su's message of "Tue, 18 Apr 2023 22:00:19 +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=-30.7 required=5.0 tests=BAYES_00,GIT_PATCH_0,KAM_DMARC_NONE,KAM_DMARC_STATUS,KAM_LAZY_DOMAIN_SECURITY,KAM_NUMSUBJECT,SPF_HELO_NONE,SPF_NONE,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: YunQiang Su writes: > If the triple is mipsisa32r6* or mipsisa64r6*, ld/as should output > r6 objects by default. > The triples with vendor `img` should do same. > > The examples include: > as xx.s -o xx.o > ld -r -b binary xx.dat -o xx.o > --- > bfd/config.bfd | 6 ++++++ > bfd/elfxx-mips.c | 6 ++++++ > gas/configure | 9 +++++++++ > gas/configure.ac | 9 +++++++++ > 4 files changed, 30 insertions(+) > > diff --git a/bfd/config.bfd b/bfd/config.bfd > index 1e4bea191dd..78752994456 100644 > --- a/bfd/config.bfd > +++ b/bfd/config.bfd > @@ -1535,3 +1535,9 @@ case "${targ_defvec} ${targ_selvecs}" in > targ_archs="$targ_archs bfd_iamcu_arch" > ;; > esac > + > +case "${targ}" in > + mipsisa32r6* | mipsisa64r6* | mips*-img-*) > + targ_cflags="$targ_cflags -DMIPS_DEFAULT_R6=1" > + ;; > +esac > diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c > index 13a89953293..0b0ea11bfb5 100644 > --- a/bfd/elfxx-mips.c > +++ b/bfd/elfxx-mips.c > @@ -12327,9 +12327,15 @@ mips_set_isa_flags (bfd *abfd) > { > default: > if (ABI_N32_P (abfd) || ABI_64_P (abfd)) > +#ifdef MIPS_DEFAULT_R6 > + val = E_MIPS_ARCH_64R6; > + else > + val = E_MIPS_ARCH_32R6; > +#else > val = E_MIPS_ARCH_3; > else > val = E_MIPS_ARCH_1; > +#endif > break; IMO it'd be better to stick: #ifndef MIPS_DEFAULT_R6 #define MIPS_DEFAULT_R6 0 #endif after the #includes and use: val = MIPS_DEFAULT_R6 ? E_MIPS_ARCH_64R6 : E_MIPS_ARCH_3; etc. OK with that change, thanks. Richard > case bfd_mach_mips3000: > diff --git a/gas/configure b/gas/configure > index 868f4a911a9..0daa80d5b4c 100755 > --- a/gas/configure > +++ b/gas/configure > @@ -12211,6 +12211,15 @@ _ACEOF > use_e_mips_abi_o32=1 > ;; > esac > + # If Vendor is IMG, then MIPSr6 is used > + case ${target} in > + mips*64*-img-*) > + mips_cpu=mips64r6 > + ;; > + mips*-img-*) > + mips_cpu=mips32r6 > + ;; > + esac > # Decide whether to generate 32-bit or 64-bit code by default. > # Used to resolve -march=from-abi when an embedded ABI is selected. > case ${target} in > diff --git a/gas/configure.ac b/gas/configure.ac > index 03728ffce4d..2b91f9ec616 100644 > --- a/gas/configure.ac > +++ b/gas/configure.ac > @@ -380,6 +380,15 @@ changequote([,])dnl > use_e_mips_abi_o32=1 > ;; > esac > + # If Vendor is IMG, then MIPSr6 is used > + case ${target} in > + mips*64*-img-*) > + mips_cpu=mips64r6 > + ;; > + mips*-img-*) > + mips_cpu=mips32r6 > + ;; > + esac > # Decide whether to generate 32-bit or 64-bit code by default. > # Used to resolve -march=from-abi when an embedded ABI is selected. > case ${target} in