mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-07-01 01:45:51 +08:00
MIPS16/GAS: Improve non-constant operand error diagnostics
Improve operand error diagnostics for non-constant expressions used for a 16-bit immediate, making the message more descriptive and indicating the offending operand, e.g.: foo.s:1: Error: invalid operands `lui $2,foo-bar' will show as: foo.s:1: Error: operand 2 must be constant `lui $2,foo-bar' This case does not currently trigger however, for two reasons. First, for regular MIPS and microMIPS assembly in the case of no match caused by `match_int_operand' here, the function is always called again from `mips_ip' via `match_insns', `match_insn' and then `match_operand' for the same opcode table's entry with `lax_match' set to TRUE, in which case the attempt to match succeeds and no error is issued. Second, in the case of MIPS16 assembly no call to `match_int_operand' is made at all for 16-bit immediates, because such immediates are currently only matched with extensible instructions, and these are handled in `match_mips16_insn' via `match_expression' directly rather than via `match_operand'. This will change for MIPS16 code with MIPS16e2 support introduced, where non-extensible instructions accepting 16-bit immediates will be added, so make the case work well right from the start. gas/ * config/tc-mips.c (match_int_operand): Call `match_not_constant' before returning failure for a non-constant 16-bit immediate conditionally allowed.
This commit is contained in:
@ -1,3 +1,9 @@
|
|||||||
|
2017-05-15 Maciej W. Rozycki <macro@imgtec.com>
|
||||||
|
|
||||||
|
* config/tc-mips.c (match_int_operand): Call
|
||||||
|
`match_not_constant' before returning failure for a non-constant
|
||||||
|
16-bit immediate conditionally allowed.
|
||||||
|
|
||||||
2017-05-15 Maciej W. Rozycki <macro@imgtec.com>
|
2017-05-15 Maciej W. Rozycki <macro@imgtec.com>
|
||||||
|
|
||||||
* config/tc-mips.c (match_const_int): Call `match_out_of_range'
|
* config/tc-mips.c (match_const_int): Call `match_out_of_range'
|
||||||
|
@ -5082,7 +5082,10 @@ match_int_operand (struct mips_arg_info *arg,
|
|||||||
/* Accept non-constant operands if no later alternative matches,
|
/* Accept non-constant operands if no later alternative matches,
|
||||||
leaving it for the caller to process. */
|
leaving it for the caller to process. */
|
||||||
if (!arg->lax_match)
|
if (!arg->lax_match)
|
||||||
return FALSE;
|
{
|
||||||
|
match_not_constant (arg);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
offset_reloc[0] = BFD_RELOC_LO16;
|
offset_reloc[0] = BFD_RELOC_LO16;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user