2021-08-17 11:55:43

by Sudip Mukherjee

[permalink] [raw]
Subject: build failure of mips decstation_r4k_defconfig with binutils-2_37

Hi All,

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 https://sourceware.org/bugzilla/show_bug.cgi?id=28241

--
Regards
Sudip


2021-08-17 12:57:39

by Ralf Baechle

[permalink] [raw]
Subject: Re: build failure of mips decstation_r4k_defconfig with binutils-2_37

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 https://sourceware.org/bugzilla/show_bug.cgi?id=28241

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
mode:

$ cat s.s
rfe
eret
$ 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?

Ralf

Signed-off-by: Ralf Baechle <[email protected]>

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

2021-08-17 13:36:41

by Sudip Mukherjee

[permalink] [raw]
Subject: Re: build failure of mips decstation_r4k_defconfig with binutils-2_37

Hi Ralf,

On Tue, Aug 17, 2021 at 1:55 PM Ralf Baechle <[email protected]> wrote:
>
> 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 https://sourceware.org/bugzilla/show_bug.cgi?id=28241
>
> 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
> mode:
>

<snip>

>
> 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?

Tested on top of v5.4.142-rc2 and it builds again. Thanks for the
quick reply and the patch.


--
Regards
Sudip

2021-08-17 13:44:03

by Maciej W. Rozycki

[permalink] [raw]
Subject: Re: build failure of mips decstation_r4k_defconfig with binutils-2_37

On Tue, 17 Aug 2021, 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 https://sourceware.org/bugzilla/show_bug.cgi?id=28241

Thanks. I have known it for a while thanks to an earlier report from
Jan-Benedict Glaw, but didn't get to fixing it. I mean to address it
sometime later this month or early Sep the latest.

This file shouldn't be built for R4k configurations in the first place
because they use the REX firmware exclusively, which this source has
nothing to do with. A trivial fix would be to override the ISA level
temporarily across RFE, but that's missing the point as it's dead code
anyway with R4k. OTOH a proper fix requires proper verification.

As a workaround use older binutils for the time being. Apologies for the
inconvenience.

Maciej

2021-08-17 13:48:15

by Maciej W. Rozycki

[permalink] [raw]
Subject: Re: build failure of mips decstation_r4k_defconfig with binutils-2_37

On Tue, 17 Aug 2021, Ralf Baechle 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 https://sourceware.org/bugzilla/show_bug.cgi?id=28241
>
> 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.

Yes, I made such a change when I discovered the mess around coprocessor
instructions in binutils earlier this year. Eighteen patches total to
straighten it out. Some instructions were misassembled even, and no
proper subsetting was made, so you could come with a nonsensical mixture
when disassembling. And RFE was disassembled as `c0 0x10' regardless of
the ISA chosen.

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

But it's missing the point, as I noted in the other message. I've been
too busy with higher priority stuff to get to a proper fix right away (I
thought I was the last one using the DECstation, and especially with the
top of the tree binutils).

Maciej