MIPS16/GAS: Improve disallowed relocation operand error diagnostics
authorMaciej W. Rozycki <macro@imgtec.com>
Mon, 15 May 2017 12:09:37 +0000 (13:09 +0100)
committerMaciej W. Rozycki <macro@imgtec.com>
Mon, 15 May 2017 12:57:08 +0000 (13:57 +0100)
commite295202f606accec7623c961997a295a8e680247
tree8b20ee6b5aaa943898b48fab2078fb74336480e6
parentc76081bc874d7d41eb6f41ea79a4ac0f906467d0
MIPS16/GAS: Improve disallowed relocation operand error diagnostics

Improve disallowed relocation operand error diagnostics for MIPS16 code
and make it match corresponding regular MIPS and microMIPS handling,
e.g:

$ cat sltu.s
sltu $2, %lo(foo)
$ as -o sltu.o sltu.s
sltu.s: Assembler messages:
sltu.s:1: Error: operand 2 must be constant `sltu $2,%lo(foo)'
$ as -mips16 -o sltu.o sltu.s
sltu.s: Assembler messages:
sltu.s:1: Error: invalid operands `sltu $2,%lo(foo)'
$

To do so call `match_not_constant' from `match_mips16_insn' whenever a
disallowed relocation operation has been noticed, like `match_const_int'
does, making reporting consistent:

$ as -mips16 -o sltu.o sltu.s
sltu.s: Assembler messages:
sltu.s:1: Error: operand 2 must be constant `sltu $2,%lo(foo)'
$

gas/
* config/tc-mips.c (match_mips16_insn): Call
`match_not_constant' for a disallowed relocation operation.
* testsuite/gas/mips/mips16-reloc-error.d: New test.
* testsuite/gas/mips/mips16-reloc-error.l: New stderr output.
* testsuite/gas/mips/mips16-reloc-error.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/mips16-reloc-error.d [new file with mode: 0644]
gas/testsuite/gas/mips/mips16-reloc-error.l [new file with mode: 0644]
gas/testsuite/gas/mips/mips16-reloc-error.s [new file with mode: 0644]