From: Przemyslaw Wirkus Date: Thu, 29 Oct 2020 16:30:46 +0000 (+0000) Subject: aarch64: Fix DSB instruction 'missing immediate expression' errors X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=59d5613e42589c6515a0bfe9baae522f164d20fa;p=binutils-gdb.git aarch64: Fix DSB instruction 'missing immediate expression' errors This patch fixes errors with DSB instruction after introduction of DSB nXS variant. That change would cause GAS to reject valid DSB immediate string operands. gas/ChangeLog: 2020-10-28 Przemyslaw Wirkus * config/tc-aarch64.c (parse_operands): Check for C0-C15 value of DSB immediate string operand. * testsuite/gas/aarch64/system-4.d: Update test. * testsuite/gas/aarch64/system-4.s: Update test. --- diff --git a/gas/config/tc-aarch64.c b/gas/config/tc-aarch64.c index a8ee74aacbb..930a00c4c26 100644 --- a/gas/config/tc-aarch64.c +++ b/gas/config/tc-aarch64.c @@ -6714,7 +6714,11 @@ parse_operands (char *str, const aarch64_opcode *opcode) { /* Regular barriers accept options CRm (C0-C15). DSB nXS barrier variant accepts values > 15. */ - po_imm_or_fail (0, 15); + if (val < 0 || val > 15) + { + set_syntax_error (_("the specified option is not accepted in DSB")); + goto failure; + } } /* This is an extension to accept a 0..15 immediate. */ if (val == PARSE_FAIL) diff --git a/gas/testsuite/gas/aarch64/system.d b/gas/testsuite/gas/aarch64/system.d index c973584af59..ea6459f3662 100644 --- a/gas/testsuite/gas/aarch64/system.d +++ b/gas/testsuite/gas/aarch64/system.d @@ -193,6 +193,20 @@ Disassembly of section \.text: .*: d5033fdf isb .*: d503309f ssbb .*: d503349f pssbb +.*: d503319f dsb oshld +.*: d503329f dsb oshst +.*: d503339f dsb osh +.*: d503359f dsb nshld +.*: d503369f dsb nshst +.*: d503379f dsb nsh +.*: d503389f dsb #0x08 +.*: d503399f dsb ishld +.*: d5033a9f dsb ishst +.*: d5033b9f dsb ish +.*: d5033c9f dsb #0x0c +.*: d5033d9f dsb ld +.*: d5033e9f dsb st +.*: d5033f9f dsb sy .*: d8000000 prfm pldl1keep, 0 .*: R_AARCH64_(P32_|)LD_PREL_LO19 LABEL1 .*: f8af6be0 prfm pldl1keep, \[sp, x15\] diff --git a/gas/testsuite/gas/aarch64/system.s b/gas/testsuite/gas/aarch64/system.s index 6f494f885a6..2cff6a2d1e6 100644 --- a/gas/testsuite/gas/aarch64/system.s +++ b/gas/testsuite/gas/aarch64/system.s @@ -48,6 +48,21 @@ ssbb pssbb + dsb oshld + dsb oshst + dsb osh + dsb nshld + dsb nshst + dsb nsh + dsb #0x08 + dsb ishld + dsb ishst + dsb ish + dsb #0x0c + dsb ld + dsb st + dsb sy + // // PREFETCHS //