[PATCH] MIPS/GAS: Use addiu instead of addi in test elf-rel

Maciej W. Rozycki macro@orcam.me.uk
Thu Nov 23 15:19:15 GMT 2023


On Thu, 23 Nov 2023, Nick Clifton wrote:

> > ADDI has been removed in MIPSr6, and thus these cases fail.
> > For all releases, ADDIU is recommended.
> > 
> > The only difference between ADDI and ADDIU, is that ADDI will trap
> > if overflow, and ADDIU won't.
> > 
> > This patch can fix a test failure on MIPSr6 default triples:
> >      MIPS ELF reloc
> > ---
> >   gas/testsuite/gas/mips/elf-rel.d   | 12 +++++-----
> >   gas/testsuite/gas/mips/elf-rel.s   | 36 +++++++++++++++---------------
> >   gas/testsuite/gas/mips/elfel-rel.d | 12 +++++-----
> 
> Approved and applied.

 The 64-bit MIPS psABI actually specified ADDI rather than ADDIU for 
certain address load sequences and <sys/asm.h> (or Linux <asm/asm.h>) 
macros used to use it.  We abandoned this practice at one point, but I 
find to deliberately remove verification for this instruction rather 
gratuitous.  This should have been done in a better way, still without 
sacrificing MIPSr6 coverage.

 In any case the change description shouldn't have been dropped from the 
commit, which I can see has been correctly prepared for applying via `git 
am'.  Right now it presents itself in the repo as if it's been done with 
no justification whatsoever, and certainly whoever comes across it in a 
few year's time will scratch their head about it.

  Maciej


More information about the Binutils mailing list