This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[Patch, AArch64] Fix the check of the system register parsing result
- From: Yufeng Zhang <Yufeng dot Zhang at arm dot com>
- To: "binutils at sourceware dot org" <binutils at sourceware dot org>
- Cc: Marcus Shawcroft <Marcus dot Shawcroft at arm dot com>
- Date: Tue, 08 Jan 2013 17:58:13 +0000
- Subject: [Patch, AArch64] Fix the check of the system register parsing result
Hi,
This simple patch fixes in the AArch64 GAS the check of the system
register parsing result. With this fix, GAS can correctly issue
diagnostics on unrecognized system registers in instructions like MSR,
MRS, etc.
OK to commit?
Thanks,
Yufeng
gas/
2013-01-08 Yufeng Zhang <yufeng.zhang@arm.com>
* config/tc-aarch64.c (parse_operands): Change to compare the
result
of function call 'parse_sys_reg' with 'PARSE_FAIL' instead of
'FALSE'.
gas/testsuite/
2013-01-08 Yufeng Zhang <yufeng.zhang@arm.com>
* gas/aarch64/diagnostic.s: Add test.
* gas/aarch64/diagnostic.l: Update.
diff --git a/gas/config/tc-aarch64.c b/gas/config/tc-aarch64.c
index 61b802c..b85a5e5 100644
--- a/gas/config/tc-aarch64.c
+++ b/gas/config/tc-aarch64.c
@@ -5050,7 +5050,8 @@ parse_operands (char *str, const aarch64_opcode *opcode)
break;
case AARCH64_OPND_SYSREG:
- if ((val = parse_sys_reg (&str, aarch64_sys_regs_hsh, 1)) == FALSE)
+ if ((val = parse_sys_reg (&str, aarch64_sys_regs_hsh, 1))
+ == PARSE_FAIL)
{
set_syntax_error (_("unknown or missing system register name"));
goto failure;
@@ -5059,7 +5060,8 @@ parse_operands (char *str, const aarch64_opcode *opcode)
break;
case AARCH64_OPND_PSTATEFIELD:
- if ((val = parse_sys_reg (&str, aarch64_pstatefield_hsh, 0)) == FALSE)
+ if ((val = parse_sys_reg (&str, aarch64_pstatefield_hsh, 0))
+ == PARSE_FAIL)
{
set_syntax_error (_("unknown or missing PSTATE field name"));
goto failure;
diff --git a/gas/testsuite/gas/aarch64/diagnostic.l b/gas/testsuite/gas/aarch64/diagnostic.l
index 714a2f0..cd8b3e2 100644
--- a/gas/testsuite/gas/aarch64/diagnostic.l
+++ b/gas/testsuite/gas/aarch64/diagnostic.l
@@ -85,3 +85,4 @@
[^:]*:87: Error: immediate offset out of range -256 to 252 at operand 3 -- `ldnp w7,w15,\[x3,#256\]'
[^:]*:88: Error: shift is not permitted at operand 2 -- `movi v1.2d,4294967295,lsl#0'
[^:]*:89: Error: shift amount non-zero at operand 2 -- `movi v1.8b,97,lsl#8'
+[^:]*:90: Error: unknown or missing system register name at operand 1 -- `msr dummy,x1'
diff --git a/gas/testsuite/gas/aarch64/diagnostic.s b/gas/testsuite/gas/aarch64/diagnostic.s
index 2b1c01c..1fa1b74 100644
--- a/gas/testsuite/gas/aarch64/diagnostic.s
+++ b/gas/testsuite/gas/aarch64/diagnostic.s
@@ -87,3 +87,4 @@
ldnp w7, w15, [x3, #256]
movi v1.2d, 4294967295, lsl #0
movi v1.8b, 97, lsl #8
+ msr dummy, x1