]> 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)
committerJohn Baldwin <jhb@FreeBSD.org>
Thu, 1 Sep 2022 22:59:24 +0000 (15:59 -0700)
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 70a78749b782a61bee1f72993b83d13a618e3386..88d637d9d65c8cf35bd707b7ec21a2467ceba4d3 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 2afc7ec0f7eeb486bb5b21557ad8de031959e7a0..d47e711aef6e61fe5bdc841320da7522ff414517 100644 (file)
@@ -2145,6 +2145,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);
@@ -2168,6 +2171,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