diff options
author | Maciej W. Rozycki <macro@imgtec.com> | 2016-12-23 12:38:35 +0000 |
---|---|---|
committer | Maciej W. Rozycki <macro@imgtec.com> | 2016-12-23 19:28:23 +0000 |
commit | 3fb49709438e204177373646585a76116caf23fb (patch) | |
tree | 1988549ca34f15eb4248d8d19e47b0c80088e006 /gas/config | |
parent | 645c455650ed35460afdacb078c7c58308607fbe (diff) | |
download | gdb-3fb49709438e204177373646585a76116caf23fb.zip gdb-3fb49709438e204177373646585a76116caf23fb.tar.gz gdb-3fb49709438e204177373646585a76116caf23fb.tar.bz2 |
MIPS16/GAS: Fix forced size suffixes with argumentless instructions
Correct the handling of `.e' and `.t' instruction size suffixes with
instruction mnemonics which are not followed by any text on the same
line, such as arguments or white space, e.g.:
$ cat test.s
.set mips16
foo:
entry.t # comment
entry.t
exit.t # comment
exit.t
nop.t # comment
nop.t
$ as -32 -o test.o test.s
test.s: Assembler messages:
test.s:4: Error: unrecognized opcode `entry.t'
test.s:6: Error: unrecognized opcode `exit.t'
test.s:8: Error: unrecognized opcode `nop.t'
$
gas/
* config/tc-mips.c (mips16_ip): Handle `.e' and `.t' instruction
suffixes followed by a null character rather than a space too.
* testsuite/gas/mips/mips16-insn-length-noargs.d: New test.
* testsuite/gas/mips/mips16-insn-length-noargs.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 | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c index a68e267..7536a5b 100644 --- a/gas/config/tc-mips.c +++ b/gas/config/tc-mips.c @@ -13857,13 +13857,14 @@ mips16_ip (char *str, struct mips_cl_insn *insn) char *end, *s, c; struct mips_opcode *first; struct mips_operand_token *tokens; - - forced_insn_length = 0; + unsigned int l; for (s = str; ISLOWER (*s); ++s) ; end = s; c = *end; + + l = 0; switch (c) { case '\0': @@ -13874,23 +13875,27 @@ mips16_ip (char *str, struct mips_cl_insn *insn) break; case '.': - if (s[1] == 't' && s[2] == ' ') + s++; + if (*s == 't') { - forced_insn_length = 2; - s += 3; - break; + l = 2; + s++; } - else if (s[1] == 'e' && s[2] == ' ') + else if (*s == 'e') { - forced_insn_length = 4; - s += 3; - break; + l = 4; + s++; } + if (*s == '\0') + break; + else if (*s++ == ' ') + break; /* Fall through. */ default: set_insn_error (0, _("unrecognized opcode")); return; } + forced_insn_length = l; *end = 0; first = (struct mips_opcode *) hash_find (mips16_op_hash, str); |