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

Fix broken commit 070961b377 ("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.
This commit is contained in:
Maciej W. Rozycki
2025-02-15 01:30:58 +00:00
parent 1c065666dd
commit 9371764e93
3 changed files with 9 additions and 2 deletions

3
gas/configure vendored
View File

@@ -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
;;

View File

@@ -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
;;

View File

@@ -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 {} \