From 3f4ff0886feae9e725ff7c244dbe8dffdb260708 Mon Sep 17 00:00:00 2001 From: Przemyslaw Wirkus Date: Mon, 16 Nov 2020 21:17:25 +0000 Subject: [PATCH] aarch64: Add +pauth flag for Pointer Authentication feature New -march option +pauth enables PAuth vel PAC (Pointer Authentication) feature. --- gas/ChangeLog | 8 +++ gas/NEWS | 3 ++ gas/config/tc-aarch64.c | 2 + gas/doc/c-aarch64.texi | 4 +- gas/testsuite/gas/aarch64/pac-feat.d | 74 ++++++++++++++++++++++++++ gas/testsuite/gas/aarch64/pac-feat.s | 79 ++++++++++++++++++++++++++++ 6 files changed, 169 insertions(+), 1 deletion(-) create mode 100644 gas/testsuite/gas/aarch64/pac-feat.d create mode 100644 gas/testsuite/gas/aarch64/pac-feat.s diff --git a/gas/ChangeLog b/gas/ChangeLog index c289dd7ed36..cdbc1ca35da 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,11 @@ +2020-11-13 Przemyslaw Wirkus + + * NEWS: Update news. + * config/tc-aarch64.c: Add option +pauth to -march. + * doc/c-aarch64.texi: Update docs. + * testsuite/gas/aarch64/pac-feat.d: New test. + * testsuite/gas/aarch64/pac-feat.s: New test. + 2020-11-16 Przemyslaw Wirkus * NEWS: Update news. diff --git a/gas/NEWS b/gas/NEWS index 1d4b4be9be1..6969d1cc3af 100644 --- a/gas/NEWS +++ b/gas/NEWS @@ -32,6 +32,9 @@ * Add support for +ls64 feature for -march in Armv8.7 AArch64. Add atomic 64-byte load/store instructions for this feature. +* Add support for +pauth (Pointer Authentication) feature for -march in + AArch64. + * Add support for Intel TDX instructions. * Add support for Intel Key Locker instructions. diff --git a/gas/config/tc-aarch64.c b/gas/config/tc-aarch64.c index ca29fdc1724..43273330376 100644 --- a/gas/config/tc-aarch64.c +++ b/gas/config/tc-aarch64.c @@ -9227,6 +9227,8 @@ static const struct aarch64_option_cpu_value_table aarch64_features[] = { AARCH64_ARCH_NONE}, {"flagm", AARCH64_FEATURE (AARCH64_FEATURE_FLAGM, 0), AARCH64_ARCH_NONE}, + {"pauth", AARCH64_FEATURE (AARCH64_FEATURE_PAC, 0), + AARCH64_ARCH_NONE}, {NULL, AARCH64_ARCH_NONE, AARCH64_ARCH_NONE}, }; diff --git a/gas/doc/c-aarch64.texi b/gas/doc/c-aarch64.texi index c005286bc4a..6031cf34dfb 100644 --- a/gas/doc/c-aarch64.texi +++ b/gas/doc/c-aarch64.texi @@ -230,8 +230,10 @@ automatically cause those extensions to be disabled. @tab Enable Flag Manipulation instructions. @item @code{csre} @tab ARMv8-A @tab No @tab Enable Call Stack Recorder Extension. -@item @code{ls64} @tab ARMv8-6 @tab ARMv8.7-A or later +@item @code{ls64} @tab ARMv8.6-A @tab ARMv8.7-A or later @tab Enable 64 Byte Loads/Stores. +@item @code{pauth} @tab ARMv8-A @tab No + @tab Enable Pointer Authentication. @end multitable @node AArch64 Syntax diff --git a/gas/testsuite/gas/aarch64/pac-feat.d b/gas/testsuite/gas/aarch64/pac-feat.d new file mode 100644 index 00000000000..9f8d9b42771 --- /dev/null +++ b/gas/testsuite/gas/aarch64/pac-feat.d @@ -0,0 +1,74 @@ +#name: PAUTH (Pointer authentication) feature +#objdump: -dr + +.*: file .* + +Disassembly of section \.text: + +0+ <.*>: +.*: dac10083 pacia x3, x4 +.*: dac103e5 pacia x5, sp +.*: dac10483 pacib x3, x4 +.*: dac107e5 pacib x5, sp +.*: dac10883 pacda x3, x4 +.*: dac10be5 pacda x5, sp +.*: dac10c83 pacdb x3, x4 +.*: dac10fe5 pacdb x5, sp +.*: dac11083 autia x3, x4 +.*: dac113e5 autia x5, sp +.*: dac11483 autib x3, x4 +.*: dac117e5 autib x5, sp +.*: dac11883 autda x3, x4 +.*: dac11be5 autda x5, sp +.*: dac11c83 autdb x3, x4 +.*: dac11fe5 autdb x5, sp +.*: dac123e5 paciza x5 +.*: dac127e5 pacizb x5 +.*: dac12be5 pacdza x5 +.*: dac12fe5 pacdzb x5 +.*: dac133e5 autiza x5 +.*: dac137e5 autizb x5 +.*: dac13be5 autdza x5 +.*: dac13fe5 autdzb x5 +.*: dac143e5 xpaci x5 +.*: dac147e5 xpacd x5 +.*: 9ac33041 pacga x1, x2, x3 +.*: 9adf3041 pacga x1, x2, sp +.*: d71f0822 braa x1, x2 +.*: d71f087f braa x3, sp +.*: d71f0c22 brab x1, x2 +.*: d71f0c7f brab x3, sp +.*: d73f0822 blraa x1, x2 +.*: d73f087f blraa x3, sp +.*: d73f0c22 blrab x1, x2 +.*: d73f0c7f blrab x3, sp +.*: d61f08bf braaz x5 +.*: d61f0cbf brabz x5 +.*: d63f08bf blraaz x5 +.*: d63f0cbf blrabz x5 +.*: d65f0bff retaa +.*: d65f0fff retab +.*: d69f0bff eretaa +.*: d69f0fff eretab +.*: f8200441 ldraa x1, \[x2\] +.*: f8200441 ldraa x1, \[x2\] +.*: f87ff483 ldraa x3, \[x4, #-8\] +.*: f82014c5 ldraa x5, \[x6, #8\] +.*: f83ff507 ldraa x7, \[x8, #4088\] +.*: f8600528 ldraa x8, \[x9, #-4096\] +.*: f82007e2 ldraa x2, \[sp\] +.*: f87067e4 ldraa x4, \[sp, #-2000\] +.*: f8a00441 ldrab x1, \[x2\] +.*: f8a00441 ldrab x1, \[x2\] +.*: f8fff483 ldrab x3, \[x4, #-8\] +.*: f8a014c5 ldrab x5, \[x6, #8\] +.*: f8bff507 ldrab x7, \[x8, #4088\] +.*: f8e00528 ldrab x8, \[x9, #-4096\] +.*: f8a007e2 ldrab x2, \[sp\] +.*: f8f067e4 ldrab x4, \[sp, #-2000\] +.*: f8201c62 ldraa x2, \[x3, #8\]! +.*: f87ffca4 ldraa x4, \[x5, #-8\]! +.*: f83fffe6 ldraa x6, \[sp, #4088\]! +.*: f8a01c62 ldrab x2, \[x3, #8\]! +.*: f8fffca4 ldrab x4, \[x5, #-8\]! +.*: f8bfffe6 ldrab x6, \[sp, #4088\]! diff --git a/gas/testsuite/gas/aarch64/pac-feat.s b/gas/testsuite/gas/aarch64/pac-feat.s new file mode 100644 index 00000000000..2a87ab98e99 --- /dev/null +++ b/gas/testsuite/gas/aarch64/pac-feat.s @@ -0,0 +1,79 @@ + /* ARMv8.3 Pointer authentication instructions. */ + .arch armv8-a+pauth + + /* Basic instructions. */ + pacia x3, x4 + pacia x5, sp + pacib x3, x4 + pacib x5, sp + pacda x3, x4 + pacda x5, sp + pacdb x3, x4 + pacdb x5, sp + + autia x3, x4 + autia x5, sp + autib x3, x4 + autib x5, sp + autda x3, x4 + autda x5, sp + autdb x3, x4 + autdb x5, sp + + paciza x5 + pacizb x5 + pacdza x5 + pacdzb x5 + + autiza x5 + autizb x5 + autdza x5 + autdzb x5 + + xpaci x5 + xpacd x5 + + pacga x1, x2, x3 + pacga x1, x2, sp + + /* Combined instructions. */ + braa x1, x2 + braa x3, sp + brab x1, x2 + brab x3, sp + blraa x1, x2 + blraa x3, sp + blrab x1, x2 + blrab x3, sp + braaz x5 + brabz x5 + blraaz x5 + blrabz x5 + + retaa + retab + eretaa + eretab + + ldraa x1, [x2] + ldraa x1, [x2,#0] + ldraa x3, [x4,#-8] + ldraa x5, [x6,#8] + ldraa x7, [x8,#4088] + ldraa x8, [x9,#-4096] + ldraa x2, [sp] + ldraa x4, [sp,#-2000] + ldrab x1, [x2] + ldrab x1, [x2,#0] + ldrab x3, [x4,#-8] + ldrab x5, [x6,#8] + ldrab x7, [x8,#4088] + ldrab x8, [x9,#-4096] + ldrab x2, [sp] + ldrab x4, [sp,#-2000] + ldraa x2, [x3, #8]! + ldraa x4, [x5, #-8]! + ldraa x6, [sp, #4088]! + ldrab x2, [x3, #8]! + ldrab x4, [x5, #-8]! + ldrab x6, [sp, #4088]! -- 2.30.2