From: Matthew Malcomson Date: Thu, 29 Jul 2021 13:23:24 +0000 (+0100) Subject: gas: aarch64: Make chericap and capinit auto-align X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b7f68b41966c482be6e90734e4b12336ca46cd51;p=thirdparty%2Fbinutils-gdb.git gas: aarch64: Make chericap and capinit auto-align 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 * 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. --- diff --git a/gas/ChangeLog b/gas/ChangeLog index 70a78749b78..88d637d9d65 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,10 @@ +2021-07-29 Matthew Malcomson + + * 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 * config/tc-aarch64.c (s_aarch64_capinit): Use 16 as size required. diff --git a/gas/config/tc-aarch64.c b/gas/config/tc-aarch64.c index 2afc7ec0f7e..d47e711aef6 100644 --- a/gas/config/tc-aarch64.c +++ b/gas/config/tc-aarch64.c @@ -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 index 00000000000..0193bd9071d --- /dev/null +++ b/gas/testsuite/gas/aarch64/morello-capinit-align.d @@ -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 index 00000000000..fce807b7910 --- /dev/null +++ b/gas/testsuite/gas/aarch64/morello-capinit-align.s @@ -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