]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit - gas/testsuite/gas/mips/mips.exp
MIPS/GAS: Clear the ASE_MIPS16E2_MT flag for recalculation
authorMaciej W. Rozycki <macro@imgtec.com>
Thu, 29 Jun 2017 23:55:07 +0000 (00:55 +0100)
committerMaciej W. Rozycki <macro@imgtec.com>
Thu, 29 Jun 2017 23:55:07 +0000 (00:55 +0100)
commit92cebb3dbea282bbf7357ed2f3f03bc92fee8c7b
tree95d606f9c826108b7c95e69ced1bf4572106b0a1
parent3df5cd139455a1448de00e1e173f3ce566a25a48
MIPS/GAS: Clear the ASE_MIPS16E2_MT flag for recalculation

Correct a commit 25499ac7ee92 ("MIPS16e2: Add MIPS16e2 ASE support") GAS
bug with the handling of the ASE_MIPS16E2_MT combination ASE flag, which
is not correctly calculated as `.set nomips16e2' and `.set nomt'
pseudo-ops are processed.  This leads to code like:

$ cat foo.s
.set nomt
evpe
.align 4, 0
$ cat bar.s
.set nomips16e2
dvpe
.align 4, 0
$

to successfully assemble where it should not:

$ as -32 -mips32r3 -mmt -mips16 -mmips16e2 -o foo.o foo.s
$ as -32 -mips32r3 -mmt -mips16 -mmips16e2 -o bar.o bar.s
$ objdump -m mips:16 -d foo.o

foo.o:     file format elf32-tradbigmips

Disassembly of section .text:

00000000 <.text>:
   0: f027 6700  evpe
...

bar.o:     file format elf32-tradbigmips

Disassembly of section .text:

00000000 <.text>:
   0: f026 6700  dvpe
...
$

This happens because ASE_MIPS16E2_MT once set in `mips_set_ase' is never
cleared.  Fix the problem by clearing it there before it is calculated
based on the ASE_MT and ASE_MIPS16E2 flags, making assembly fail as
expected:

$ as -32 -mips32r3 -mmt -mips16 -mmips16e2 -o foo.o foo.s
foo.s: Assembler messages:
foo.s:2: Error: opcode not supported on this processor: mips32r3 (mips32r3) `evpe'
$ as -32 -mips32r3 -mmt -mips16 -mmips16e2 -o bar.o bar.s
bar.s: Assembler messages:
bar.s:2: Error: opcode not supported on this processor: mips32r3 (mips32r3) `dvpe'
$

gas/
* config/tc-mips.c (mips_set_ase): Clear the ASE_MIPS16E2_MT
flag before recalculating.
* testsuite/gas/mips/mips16e2-mt-err.d: New test.
* testsuite/gas/mips/mips16e2-mt-err.l: New stderr output.
* testsuite/gas/mips/mips16e2-mt-err.s: New test source.
* testsuite/gas/mips/mips.exp: Run the new test.
gas/ChangeLog
gas/config/tc-mips.c
gas/testsuite/gas/mips/mips.exp
gas/testsuite/gas/mips/mips16e2-mt-err.d [new file with mode: 0644]
gas/testsuite/gas/mips/mips16e2-mt-err.l [new file with mode: 0644]
gas/testsuite/gas/mips/mips16e2-mt-err.s [new file with mode: 0644]