[binutils-gdb] MIPS/GAS: Set default CPU to MIPS64r6 for 64-bit "img" configurations

Maciej W. Rozycki macro@sourceware.org
Sat Feb 15 01:35:01 GMT 2025


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=9371764e93059ed193a5b5ee8fb268f81e677d9c

commit 9371764e93059ed193a5b5ee8fb268f81e677d9c
Author: Maciej W. Rozycki <macro@orcam.me.uk>
Date:   Sat Feb 15 01:30:58 2025 +0000

    MIPS/GAS: Set default CPU to MIPS64r6 for 64-bit "img" configurations
    
    Fix broken commit 070961b377b3 ("MIPS: Set r6 as default arch if vendor
    is img") that sets up GAS in an inconsistent way where "img" vendor has
    been used with a 64-bit configuration, such as `mips64-img-linux-gnu'.
    In that case GAS is set up to use a 64-bit ABI by default combined with
    the MIPS32r6 CPU, which is 32-bit.
    
    Consequently GAS always fails to assemble even trivial input, producing
    a message such as:
    
    Assembler messages:
    Error: -march=mips32r6 is not compatible with the selected ABI
    .../gas/testsuite/gas/all/nop.s:2: Error: `gp=32' used with a 64-bit ABI
    
    unless the defaults have been suitably overridden either for the ABI or
    the CPU.
    
    Set the default CPU to MIPS64r6 for 64-bit "img" vendor configurations
    then and adjust the GAS testsuite accordingly, removing 1048 FAIL and 3
    ERROR regression test results for the `mips64-img-linux-gnu' and
    `mips64el-img-linux-gnu' targets each.

Diff:
---
 gas/configure                   | 3 +++
 gas/configure.ac                | 3 +++
 gas/testsuite/gas/mips/mips.exp | 5 +++--
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/gas/configure b/gas/configure
index aee531d47db..d3a369863fc 100755
--- a/gas/configure
+++ b/gas/configure
@@ -12277,6 +12277,9 @@ _ACEOF
 	esac
 	# If Vendor is IMG, then MIPSr6 is used
 	case ${target} in
+	  mips64*-img-*)
+	    mips_cpu=mips64r6
+	    ;;
 	  mips*-img-*)
 	    mips_cpu=mips32r6
 	    ;;
diff --git a/gas/configure.ac b/gas/configure.ac
index 2ab77706d4c..0bde39992cf 100644
--- a/gas/configure.ac
+++ b/gas/configure.ac
@@ -394,6 +394,9 @@ changequote([,])dnl
 	esac
 	# If Vendor is IMG, then MIPSr6 is used
 	case ${target} in
+	  mips64*-img-*)
+	    mips_cpu=mips64r6
+	    ;;
 	  mips*-img-*)
 	    mips_cpu=mips32r6
 	    ;;
diff --git a/gas/testsuite/gas/mips/mips.exp b/gas/testsuite/gas/mips/mips.exp
index fbd0166f7e8..1b6efda6eda 100644
--- a/gas/testsuite/gas/mips/mips.exp
+++ b/gas/testsuite/gas/mips/mips.exp
@@ -481,7 +481,8 @@ mips_arch_create mips32r5 32	mips32r3 { fpisa3 fpisa4 fpisa5 ror } \
 mips_arch_create mips32r6 32	mips32r5 { fpisa3 fpisa4 fpisa5 ror } \
 			{ -march=mips32r6 -mtune=mips32r6 --defsym r6=} \
 			{ -mmips:isa32r6 } \
-			{ mipsisa32r6-*-* mipsisa32r6el-*-* mips*-img-* }
+			{ mipsisa32r6-*-* mipsisa32r6el-*-*
+			  !mips64*-img-* mips*-img-* }
 mips_arch_create mips64	64	mips5	{ mips32 } \
 			{ -march=mips64 -mtune=mips64 } { -mmips:isa64 } \
 			{ mipsisa64-*-* mipsisa64el-*-* }
@@ -500,7 +501,7 @@ mips_arch_create mips64r5 64	mips64r3 { mips32r5 ror } \
 mips_arch_create mips64r6 64	mips64r5 { mips32r6 ror } \
 			{ -march=mips64r6 -mtune=mips64r6 --defsym r6=} \
 			{ -mmips:isa64r6 } \
-			{ mipsisa64r6-*-* mipsisa64r6el-*-* }
+			{ mipsisa64r6-*-* mipsisa64r6el-*-* mips64*-img-* }
 mips_arch_create mips16-32 32	{}	{} \
 			{ -march=mips1 -mips16 } { -mmips:3000 }
 mips_arch_create mips16-64 64	mips16-32	{} \


More information about the Binutils-cvs mailing list