aboutsummaryrefslogtreecommitdiff
path: root/gas/config
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@imgtec.com>2016-12-23 18:06:55 +0000
committerMaciej W. Rozycki <macro@imgtec.com>2016-12-23 19:38:41 +0000
commit1da43accb4f8e2a19dc033b617982e3c2dc83a08 (patch)
treeb7e33ea0912ced9dc0e4f9774fe9fe4ebbdb55c4 /gas/config
parentd8722d7641d234dcd3d1f2254fbc5d9cf234e4e6 (diff)
downloadgdb-1da43accb4f8e2a19dc033b617982e3c2dc83a08.zip
gdb-1da43accb4f8e2a19dc033b617982e3c2dc83a08.tar.gz
gdb-1da43accb4f8e2a19dc033b617982e3c2dc83a08.tar.bz2
MIPS16/GAS: Clean up invalid unextended operand handling
Bail out right away when an unextended instruction encoding is required either with the use of a `.t' suffix or by means of `.set noautoextend', however an operand supplied requires the extended instruction form to be used. This is to avoid messing up with the internal state of the assembler, even though no actual failures are known to happen as a result. Add test cases for the situation concerned. gas/ * config/tc-mips.c (match_mips16_insn): Don't update `forced_insn_length' or the instruction opcode if an operand requires an extended instruction form, but an unextended one has been requested. * testsuite/gas/mips/mips16-relax-unextended-1.d: New test. * testsuite/gas/mips/mips16-relax-unextended-2.d: New test. * testsuite/gas/mips/mips16-relax-unextended-1.l: New stderr output. * testsuite/gas/mips/mips16-relax-unextended-2.l: New stderr output. * testsuite/gas/mips/mips16-relax-unextended-1.s: New test source. * testsuite/gas/mips/mips16-relax-unextended-2.s: New test source. * testsuite/gas/mips/mips.exp: Run the new tests.
Diffstat (limited to 'gas/config')
-rw-r--r--gas/config/tc-mips.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c
index e6b8c1b..20e8020 100644
--- a/gas/config/tc-mips.c
+++ b/gas/config/tc-mips.c
@@ -8136,8 +8136,11 @@ match_mips16_insn (struct mips_cl_insn *insn, const struct mips_opcode *opcode,
{
if (required_insn_length == 2)
set_insn_error (0, _("invalid unextended operand value"));
- forced_insn_length = 4;
- insn->insn_opcode |= MIPS16_EXTEND;
+ else
+ {
+ forced_insn_length = 4;
+ insn->insn_opcode |= MIPS16_EXTEND;
+ }
}
else if (relax_char)
*offset_reloc = (int) BFD_RELOC_UNUSED + relax_char;