Re: build failure of mips decstation_r4k_defconfig with binutils-2_37

From: Ralf Baechle
Date: Tue Aug 17 2021 - 08:55:43 EST

On Tue, Aug 17, 2021 at 12:54:32PM +0100, Sudip Mukherjee wrote:

> While I was testing v5.4.142-rc2 I noticed mips build of
> decstation_r4k_defconfig fails with binutils-2_37. The error is:
> arch/mips/dec/prom/locore.S: Assembler messages:
> arch/mips/dec/prom/locore.S:29: Error: opcode not supported on this
> processor: r4600 (mips3) `rfe'
> I have also reported this at

It would appear gas got more anal about ISA checking for the RFE instructions
which did only exist in MIPS I and II; MIPS III and later use ERET for
returning from an exception.

The older gas I've got installed here happily accepts RFE in MIPS III/R4000

$ cat s.s
$ mips-linux-as -o s.o s.s
s.s: Assembler messages:
s.s:2: Error: opcode not supported on this processor: mips1 (mips1) `eret'
$ mips-linux-as -march=r4000 -o s.o s.s
$ mips-linux-objdump -d s.o

s.o: file format elf32-tradbigmips

Disassembly of section .text:

00000000 <.text>:
0: 42000010 c0 0x10 # <- RFE
4: 42000018 eret

It's easy to find arguments for why this gas change is the right thing to
do - and not the right thing to do.

It should be fixable by simply putting gas into mips1 mode. Can you test
below patch?


Signed-off-by: Ralf Baechle <ralf@xxxxxxxxxxxxxx>

diff --git a/arch/mips/dec/prom/locore.S b/arch/mips/dec/prom/locore.S
index 0eb8fab62ab0..8d00ca8872f9 100644
--- a/arch/mips/dec/prom/locore.S
+++ b/arch/mips/dec/prom/locore.S
@@ -16,6 +16,7 @@
NESTED(genexcept_early, 0, sp)
.set noat
.set noreorder
+ .set mips1

mfc0 k0, CP0_STATUS
la k1, mem_err