mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-20 09:58:19 +08:00
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.
This commit is contained in:
@ -1,3 +1,12 @@
|
|||||||
|
2016-12-23 Maciej W. Rozycki <macro@imgtec.com>
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
2016-12-23 Maciej W. Rozycki <macro@imgtec.com>
|
2016-12-23 Maciej W. Rozycki <macro@imgtec.com>
|
||||||
|
|
||||||
* testsuite/gas/mips/mips16-extend-swap.d: New test.
|
* testsuite/gas/mips/mips16-extend-swap.d: New test.
|
||||||
|
@ -13857,13 +13857,14 @@ mips16_ip (char *str, struct mips_cl_insn *insn)
|
|||||||
char *end, *s, c;
|
char *end, *s, c;
|
||||||
struct mips_opcode *first;
|
struct mips_opcode *first;
|
||||||
struct mips_operand_token *tokens;
|
struct mips_operand_token *tokens;
|
||||||
|
unsigned int l;
|
||||||
forced_insn_length = 0;
|
|
||||||
|
|
||||||
for (s = str; ISLOWER (*s); ++s)
|
for (s = str; ISLOWER (*s); ++s)
|
||||||
;
|
;
|
||||||
end = s;
|
end = s;
|
||||||
c = *end;
|
c = *end;
|
||||||
|
|
||||||
|
l = 0;
|
||||||
switch (c)
|
switch (c)
|
||||||
{
|
{
|
||||||
case '\0':
|
case '\0':
|
||||||
@ -13874,23 +13875,27 @@ mips16_ip (char *str, struct mips_cl_insn *insn)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case '.':
|
case '.':
|
||||||
if (s[1] == 't' && s[2] == ' ')
|
s++;
|
||||||
|
if (*s == 't')
|
||||||
{
|
{
|
||||||
forced_insn_length = 2;
|
l = 2;
|
||||||
s += 3;
|
s++;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
else if (s[1] == 'e' && s[2] == ' ')
|
else if (*s == 'e')
|
||||||
{
|
{
|
||||||
forced_insn_length = 4;
|
l = 4;
|
||||||
s += 3;
|
s++;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
if (*s == '\0')
|
||||||
|
break;
|
||||||
|
else if (*s++ == ' ')
|
||||||
|
break;
|
||||||
/* Fall through. */
|
/* Fall through. */
|
||||||
default:
|
default:
|
||||||
set_insn_error (0, _("unrecognized opcode"));
|
set_insn_error (0, _("unrecognized opcode"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
forced_insn_length = l;
|
||||||
|
|
||||||
*end = 0;
|
*end = 0;
|
||||||
first = (struct mips_opcode *) hash_find (mips16_op_hash, str);
|
first = (struct mips_opcode *) hash_find (mips16_op_hash, str);
|
||||||
|
@ -1344,6 +1344,7 @@ if { [istarget mips*-*-vxworks*] } {
|
|||||||
run_dump_test "mips16-extend-swap"
|
run_dump_test "mips16-extend-swap"
|
||||||
run_dump_test "mips16-sprel-swap"
|
run_dump_test "mips16-sprel-swap"
|
||||||
run_dump_test "mips16-sdrasp"
|
run_dump_test "mips16-sdrasp"
|
||||||
|
run_dump_test "mips16-insn-length-noargs"
|
||||||
|
|
||||||
run_dump_test "mips16-branch-unextended-1"
|
run_dump_test "mips16-branch-unextended-1"
|
||||||
run_dump_test "mips16-branch-unextended-2"
|
run_dump_test "mips16-branch-unextended-2"
|
||||||
|
14
gas/testsuite/gas/mips/mips16-insn-length-noargs.d
Normal file
14
gas/testsuite/gas/mips/mips16-insn-length-noargs.d
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#objdump: -d --prefix-addresses --show-raw-insn
|
||||||
|
#name: MIPS16 argumentless instruction size override
|
||||||
|
#as: -32
|
||||||
|
|
||||||
|
.*: +file format .*mips.*
|
||||||
|
|
||||||
|
Disassembly of section \.text:
|
||||||
|
[0-9a-f]+ <[^>]*> e809 entry
|
||||||
|
[0-9a-f]+ <[^>]*> e809 entry
|
||||||
|
[0-9a-f]+ <[^>]*> ef09 exit
|
||||||
|
[0-9a-f]+ <[^>]*> ef09 exit
|
||||||
|
[0-9a-f]+ <[^>]*> 6500 nop
|
||||||
|
[0-9a-f]+ <[^>]*> 6500 nop
|
||||||
|
\.\.\.
|
12
gas/testsuite/gas/mips/mips16-insn-length-noargs.s
Normal file
12
gas/testsuite/gas/mips/mips16-insn-length-noargs.s
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
.set mips16
|
||||||
|
foo:
|
||||||
|
entry.t # comment
|
||||||
|
entry.t
|
||||||
|
exit.t # comment
|
||||||
|
exit.t
|
||||||
|
nop.t # comment
|
||||||
|
nop.t
|
||||||
|
|
||||||
|
# Force some (non-delay-slot) zero bytes, to make 'objdump' print ...
|
||||||
|
.align 4, 0
|
||||||
|
.space 16
|
Reference in New Issue
Block a user