aarch64: Fix DSB instruction 'missing immediate expression' errors
authorPrzemyslaw Wirkus <przemyslaw.wirkus@arm.com>
Thu, 29 Oct 2020 16:30:46 +0000 (16:30 +0000)
committerPrzemyslaw Wirkus <przemyslaw.wirkus@arm.com>
Thu, 29 Oct 2020 16:33:00 +0000 (16:33 +0000)
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  <przemyslaw.wirkus@arm.com>

* 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.

gas/config/tc-aarch64.c
gas/testsuite/gas/aarch64/system.d
gas/testsuite/gas/aarch64/system.s

index a8ee74aacbb48697fa9e1ab4214171f42483fb3d..930a00c4c260738fc3dc7ee85306b848e4516d4f 100644 (file)
@@ -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)
index c973584af59e555ed71999eea1401f9ec713a795..ea6459f366209fe23877387773c8ff0aa0539155 100644 (file)
@@ -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 <LABEL1>
 .*: R_AARCH64_(P32_|)LD_PREL_LO19      LABEL1
 .*:    f8af6be0        prfm    pldl1keep, \[sp, x15\]
index 6f494f885a648652d998463c0abf51f17da76b38..2cff6a2d1e64010b1fcdceb6ac270fef10343ee1 100644 (file)
        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
        //