From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7863) id C5D163858C50; Sun, 23 Apr 2023 06:33:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C5D163858C50 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: YunQiang Su To: bfd-cvs@sourceware.org Subject: [binutils-gdb] MIPS: default output r6 obj if the triple is r6 X-Act-Checkin: binutils-gdb X-Git-Author: YunQiang Su X-Git-Refname: refs/heads/master X-Git-Oldrev: 32f1c80375ebe8ad25d9805ee5889f0006c51e59 X-Git-Newrev: 9171de358f230b64646bbb525a74e5f8e3dbe0dc Message-Id: <20230423063324.C5D163858C50@sourceware.org> Date: Sun, 23 Apr 2023 06:33:24 +0000 (GMT) X-BeenThere: binutils-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2023 06:33:24 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D9171de358f23= 0b64646bbb525a74e5f8e3dbe0dc commit 9171de358f230b64646bbb525a74e5f8e3dbe0dc Author: YunQiang Su Date: Tue Apr 18 21:49:22 2023 +0800 MIPS: default output r6 obj if the triple is r6 =20 If the triple is mipsisa32r6* or mipsisa64r6*, ld/as should output r6 objects by default. The triples with vendor `img` should do same. =20 The examples include: as xx.s -o xx.o ld -r -b binary xx.dat -o xx.o Diff: --- bfd/config.bfd | 6 ++++++ bfd/elfxx-mips.c | 4 ++-- bfd/elfxx-mips.h | 4 ++++ gas/configure | 9 +++++++++ gas/configure.ac | 9 +++++++++ 5 files changed, 30 insertions(+), 2 deletions(-) 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=3D"$targ_archs bfd_iamcu_arch" ;; esac + +case "${targ}" in + mipsisa32r6* | mipsisa64r6* | mips*-img-*) + targ_cflags=3D"$targ_cflags -DMIPS_DEFAULT_R6=3D1" + ;; +esac diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c index 13a89953293..c9cd2f8099f 100644 --- a/bfd/elfxx-mips.c +++ b/bfd/elfxx-mips.c @@ -12327,9 +12327,9 @@ mips_set_isa_flags (bfd *abfd) { default: if (ABI_N32_P (abfd) || ABI_64_P (abfd)) - val =3D E_MIPS_ARCH_3; + val =3D MIPS_DEFAULT_R6 ? E_MIPS_ARCH_64R6 : E_MIPS_ARCH_3; else - val =3D E_MIPS_ARCH_1; + val =3D MIPS_DEFAULT_R6 ? E_MIPS_ARCH_32R6 : E_MIPS_ARCH_1; break; =20 case bfd_mach_mips3000: diff --git a/bfd/elfxx-mips.h b/bfd/elfxx-mips.h index 4addf6f5d1a..f15dceac48e 100644 --- a/bfd/elfxx-mips.h +++ b/bfd/elfxx-mips.h @@ -29,6 +29,10 @@ enum reloc_check check_shuffle }; =20 +#ifndef MIPS_DEFAULT_R6 +#define MIPS_DEFAULT_R6 0 +#endif + extern bool _bfd_mips_elf_mkobject (bfd *); extern bool _bfd_mips_elf_close_and_cleanup 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=3D1 ;; esac + # If Vendor is IMG, then MIPSr6 is used + case ${target} in + mips*64*-img-*) + mips_cpu=3Dmips64r6 + ;; + mips*-img-*) + mips_cpu=3Dmips32r6 + ;; + esac # Decide whether to generate 32-bit or 64-bit code by default. # Used to resolve -march=3Dfrom-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=3D1 ;; esac + # If Vendor is IMG, then MIPSr6 is used + case ${target} in + mips*64*-img-*) + mips_cpu=3Dmips64r6 + ;; + mips*-img-*) + mips_cpu=3Dmips32r6 + ;; + esac # Decide whether to generate 32-bit or 64-bit code by default. # Used to resolve -march=3Dfrom-abi when an embedded ABI is selected. case ${target} in