]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gas: aarch64: Make chericap and capinit auto-align
authorMatthew Malcomson <matthew.malcomson@arm.com>
Thu, 29 Jul 2021 13:23:24 +0000 (14:23 +0100)
committerMatthew Malcomson <matthew.malcomson@arm.com>
Thu, 29 Jul 2021 15:16:39 +0000 (16:16 +0100)
Morello LLVM assumes that these directives should auto-align, it emits
assembly that does not explicitly align these directives.

Fix and testcases added.

gas/ChangeLog:

2021-07-29  Matthew Malcomson  <matthew.malcomson@arm.com>

* config/tc-aarch64.c (s_aarch64_capinit, s_aarch64_chericap):
Automatically align to 16 bytes.
* testsuite/gas/aarch64/morello-capinit-align.s: New.
* testsuite/gas/aarch64/morello-capinit-align.d: New.

gas/ChangeLog
gas/config/tc-aarch64.c
gas/testsuite/gas/aarch64/morello-capinit-align.d [new file with mode: 0644]
gas/testsuite/gas/aarch64/morello-capinit-align.s [new file with mode: 0644]

index 451f59ce1431b510d9769d05ca008db985c97989..81d580b64c52985128b4cd682d227dfec5eaf239 100644 (file)
@@ -1,3 +1,10 @@
+2021-07-29  Matthew Malcomson  <matthew.malcomson@arm.com>
+
+       * config/tc-aarch64.c (s_aarch64_capinit, s_aarch64_chericap):
+       Automatically align to 16 bytes.
+       * testsuite/gas/aarch64/morello-capinit-align.s: New.
+       * testsuite/gas/aarch64/morello-capinit-align.d: New.
+
 2021-07-29  Matthew Malcomson  <matthew.malcomson@arm.com>
 
        * config/tc-aarch64.c (s_aarch64_capinit): Use 16 as size required.
index 89abdc62e4e97049856d6d22966b90ae147a52bf..3d0436d538c856a418f6949fb47998f69558b6fc 100644 (file)
@@ -2170,6 +2170,9 @@ s_aarch64_capinit (int ignored ATTRIBUTE_UNUSED)
       return;
     }
 
+  /* align to 16 bytes. */
+  do_align (4, (char *) NULL, 0, 0);
+
   frag_grow (16);
   fix_new_aarch64 (frag_now, frag_more (0) - frag_now->fr_literal, 16, &exp, 0,
                   BFD_RELOC_MORELLO_CAPINIT);
@@ -2193,6 +2196,9 @@ s_aarch64_chericap (int ignored ATTRIBUTE_UNUSED)
   md_flush_pending_output ();
 #endif
 
+  /* align to 16 bytes. */
+  do_align (4, (char *) NULL, 0, 0);
+
   frag_grow (16);
   fix_new_aarch64 (frag_now, frag_more (0) - frag_now->fr_literal, 16, &exp, 0,
                   BFD_RELOC_MORELLO_CAPINIT);
diff --git a/gas/testsuite/gas/aarch64/morello-capinit-align.d b/gas/testsuite/gas/aarch64/morello-capinit-align.d
new file mode 100644 (file)
index 0000000..0193bd9
--- /dev/null
@@ -0,0 +1,10 @@
+#name: capinit and chericap automatically align
+#as: -march=armv8-a+c64
+#readelf: --relocs
+
+Relocation section '\.rela\.data' at offset 0x138 contains 4 entries:
+  Offset          Info           Type           Sym\. Value    Sym\. Name \+ Addend
+000000000010  00040000e800 R_MORELLO_CAPINIT 0000000000000000 f \+ 0
+000000000030  00040000e800 R_MORELLO_CAPINIT 0000000000000000 f \+ 0
+000000000040  00040000e800 R_MORELLO_CAPINIT 0000000000000000 f \+ 0
+000000000050  00040000e800 R_MORELLO_CAPINIT 0000000000000000 f \+ 0
diff --git a/gas/testsuite/gas/aarch64/morello-capinit-align.s b/gas/testsuite/gas/aarch64/morello-capinit-align.s
new file mode 100644 (file)
index 0000000..fce807b
--- /dev/null
@@ -0,0 +1,16 @@
+.data
+f:
+// A few capability initialisation directives with a single byte to show the
+// padding gets introduced when needed.
+.byte 0
+.capinit f
+.xword 0
+.xword 0
+.byte 0
+.chericap f
+// A few directives without any bytes in between to show no extra padding gets
+// added when not needed.
+.chericap f
+.capinit f
+.xword 0
+.xword 0