diff options
author | Jose E. Marchesi <jose.marchesi@oracle.com> | 2016-11-25 03:40:15 -0800 |
---|---|---|
committer | Jose E. Marchesi <jose.marchesi@oracle.com> | 2016-11-25 03:40:15 -0800 |
commit | 65d1cff97c066e4399a175ef7294a5343c0b94d1 (patch) | |
tree | 846d7a62f3ae9c81677827c40a78f99ffb4ed19c /gas/config | |
parent | ec8f76882145c71bef81a9cadf0bf51ff9fa5b35 (diff) | |
download | gdb-65d1cff97c066e4399a175ef7294a5343c0b94d1.zip gdb-65d1cff97c066e4399a175ef7294a5343c0b94d1.tar.gz gdb-65d1cff97c066e4399a175ef7294a5343c0b94d1.tar.bz2 |
gas: fix CBCOND diagnostics for invalid immediate operands.
This patch fixes two problems in the SPARC assembler:
- The diagnostic message
Error: Illegal operands: Immediate value in cbcond is out of range.
is incorrectly issued for non-CBCOND instructions that feature a
simm5 immediate field, such as MPMUL, MONTMUL, etc.
- When an invalid immediate operand is used in a CBCOND
instruction, two redundant error messages are issued to the
user, the second due to a stale fixup (this happens since
commit 85024cd8bcb93f4112470ecdbd6c10fc2aea724f).
Some diagnostic tests for the CBCOND instructions are also
included in the patch.
Tested in both sparc64-linux-gnu and sparcv9-linux-gnu targets.
gas/ChangeLog:
2016-11-25 Jose E. Marchesi <jose.marchesi@oracle.com>
* config/tc-sparc.c (sparc_ip): Avoid emitting a cbcond error
messages for non-cbcond instructions.
* testsuite/gas/sparc/cbcond-diag.s: New file.
* testsuite/gas/sparc/cbcond-diag.l: Likewise.
* testsuite/gas/sparc/sparc.exp (gas_64_check): Run cbcond-diag tests.
Diffstat (limited to 'gas/config')
-rw-r--r-- | gas/config/tc-sparc.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/gas/config/tc-sparc.c b/gas/config/tc-sparc.c index edece05..52c1b24 100644 --- a/gas/config/tc-sparc.c +++ b/gas/config/tc-sparc.c @@ -2937,17 +2937,18 @@ sparc_ip (char *str, const struct sparc_opcode **pinsn) handle the R_SPARC_5 immediate directly here so that we don't need to add support for multiple relocations in one instruction just yet. */ - if (the_insn.reloc == BFD_RELOC_SPARC_5) + if (the_insn.reloc == BFD_RELOC_SPARC_5 + && ((insn->match & OP(0x3)) == 0)) { valueT val = the_insn.exp.X_add_number; + the_insn.reloc = BFD_RELOC_NONE; if (! in_bitfield_range (val, 0x1f)) { error_message = _(": Immediate value in cbcond is out of range."); goto error; } opcode |= val & 0x1f; - the_insn.reloc = BFD_RELOC_NONE; } } |