diff options
author | Maciej W. Rozycki <macro@imgtec.com> | 2017-05-15 13:09:37 +0100 |
---|---|---|
committer | Maciej W. Rozycki <macro@imgtec.com> | 2017-05-15 13:57:08 +0100 |
commit | e295202f606accec7623c961997a295a8e680247 (patch) | |
tree | 8b20ee6b5aaa943898b48fab2078fb74336480e6 /gas/config | |
parent | c76081bc874d7d41eb6f41ea79a4ac0f906467d0 (diff) | |
download | gdb-e295202f606accec7623c961997a295a8e680247.zip gdb-e295202f606accec7623c961997a295a8e680247.tar.gz gdb-e295202f606accec7623c961997a295a8e680247.tar.bz2 |
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.
Diffstat (limited to 'gas/config')
-rw-r--r-- | gas/config/tc-mips.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c index 27ce043..0932cea 100644 --- a/gas/config/tc-mips.c +++ b/gas/config/tc-mips.c @@ -8259,7 +8259,10 @@ match_mips16_insn (struct mips_cl_insn *insn, const struct mips_opcode *opcode, been allowed to take relocation operators. */ if (offset_reloc[0] != BFD_RELOC_UNUSED && (ext_operand->size != 16 || c == '8')) - return FALSE; + { + match_not_constant (&arg); + return FALSE; + } relax_char = c; continue; |