mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-07-29 21:04:22 +08:00
S12Z: gas: Fix bug when a symbol name was the single letter 'c'.
The assembler incorrectly recognised "c" as a register name, and refused to allow it where it expected a symbol/label. gas/ * config/tc-s12z.c (lex_reg_name): Compare the length of the strings before the contents. * testsuite/gas/s12z/labels.d: New file. * testsuite/gas/s12z/labels.s: New file. * testsuite/gas/s12z/s12z.exp: Add them.
This commit is contained in:
@ -1,5 +1,10 @@
|
|||||||
2019-01-16 John Darrington <john@darrington.wattle.id.au>
|
2019-01-16 John Darrington <john@darrington.wattle.id.au>
|
||||||
|
|
||||||
|
* config/tc-s12z.c (lex_reg_name): Compare the length of the strings
|
||||||
|
before the contents.
|
||||||
|
* testsuite/gas/s12z/labels.d: New file.
|
||||||
|
* testsuite/gas/s12z/labels.s: New file.
|
||||||
|
* testsuite/gas/s12z/s12z.exp: Add them.
|
||||||
* config/tc-s12z.c (tfr): Change as_bad to as_warn.
|
* config/tc-s12z.c (tfr): Change as_bad to as_warn.
|
||||||
Also fix message typo and semantics.
|
Also fix message typo and semantics.
|
||||||
* config/tc-s12z.c (emit_opr): Emit BFD_RELOC_S12Z_OPR instead of
|
* config/tc-s12z.c (emit_opr): Emit BFD_RELOC_S12Z_OPR instead of
|
||||||
|
@ -308,7 +308,7 @@ lex_reg_name (uint16_t which, int *reg)
|
|||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
|
|
||||||
int len = p - input_line_pointer;
|
size_t len = p - input_line_pointer;
|
||||||
|
|
||||||
if (len <= 0)
|
if (len <= 0)
|
||||||
return 0;
|
return 0;
|
||||||
@ -318,7 +318,8 @@ lex_reg_name (uint16_t which, int *reg)
|
|||||||
{
|
{
|
||||||
gas_assert (registers[i].name);
|
gas_assert (registers[i].name);
|
||||||
|
|
||||||
if (0 == strncasecmp (registers[i].name, input_line_pointer, len))
|
if (len == strlen (registers[i].name)
|
||||||
|
&& 0 == strncasecmp (registers[i].name, input_line_pointer, len))
|
||||||
{
|
{
|
||||||
if ((0x1U << i) & which)
|
if ((0x1U << i) & which)
|
||||||
{
|
{
|
||||||
|
18
gas/testsuite/gas/s12z/labels.d
Normal file
18
gas/testsuite/gas/s12z/labels.d
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#objdump: -d -r
|
||||||
|
#name: check that certain symbol labels are correctly accepted.
|
||||||
|
#source: labels.s
|
||||||
|
|
||||||
|
|
||||||
|
.*: file format elf32-s12z
|
||||||
|
|
||||||
|
|
||||||
|
Disassembly of section .text:
|
||||||
|
|
||||||
|
00000000 <.text>:
|
||||||
|
0: c4 fa 00 00 st d0, 0
|
||||||
|
4: 00
|
||||||
|
2: R_S12Z_OPR c
|
||||||
|
5: c4 bd st d0, d1
|
||||||
|
7: c5 fa 00 00 st d1, 0
|
||||||
|
b: 00
|
||||||
|
9: R_S12Z_OPR xavier
|
3
gas/testsuite/gas/s12z/labels.s
Normal file
3
gas/testsuite/gas/s12z/labels.s
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
st d0, c ; c is a valid label
|
||||||
|
st d0, d1 ; Move D0 into the memory at address D1
|
||||||
|
st d1, xavier ; This is a valid label
|
@ -119,6 +119,7 @@ run_dump_test bit-manip-invalid
|
|||||||
run_dump_test opr-symbol
|
run_dump_test opr-symbol
|
||||||
run_dump_test brclr-symbols
|
run_dump_test brclr-symbols
|
||||||
run_dump_test dbCC
|
run_dump_test dbCC
|
||||||
|
run_dump_test labels
|
||||||
|
|
||||||
# Expression related tests
|
# Expression related tests
|
||||||
run_dump_test opr-expr
|
run_dump_test opr-expr
|
||||||
|
Reference in New Issue
Block a user