From 8d59fa447f688b7863a5b3e6af5015e36c7f0024 Mon Sep 17 00:00:00 2001 From: Srinath Parvathaneni Date: Wed, 16 Oct 2024 15:42:08 +0100 Subject: aarch64: Add support for GCS to AArch64 linker This patch adds support for Guarded Control Stack in AArch64 linker. This patch implements the following: 1) Defines GNU_PROPERTY_AARCH64_FEATURE_1_GCS bit for GCS in GNU_PROPERTY_AARCH64_FEATURE_1_AND macro. 2) Adds readelf support to read and print the GNU properties in AArch64. Displaying notes found in: .note.gnu.property [ ]+Owner[ ]+Data size[ ]+Description GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0 Properties: AArch64 feature: GCS 3) Adds support for the "-z gcs" linker option and document all the values allowed with this option (-z gcs[=always|never|implicit]) where "-z gcs" is equivalent to "-z gcs=always" and when this option is not passed in the command line, it defaults to "implicit". 4) Adds support for the "-z gcs-report" linker option and document all the values allowed with this option (-z gcs-report[=none|warning|error]) where "-z gcs-report" is equivalent to "-z gcs-report=none" and when this option is not passed in the command line, it defaults to "none". The ABI changes adding GNU_PROPERTY_AARCH64_FEATURE_1_GCS to the GNU property GNU_PROPERTY_AARCH64_FEATURE_1_AND is merged into main and can be found in [1]. [1] https://github.com/ARM-software/abi-aa/blob/main/sysvabi64/sysvabi64.rst Co-authored-by: Matthieu Longo Co-authored-by: Yury Khrustalev --- include/elf/common.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/elf/common.h b/include/elf/common.h index c9920e7..c4eb33b 100644 --- a/include/elf/common.h +++ b/include/elf/common.h @@ -1037,6 +1037,7 @@ #define GNU_PROPERTY_AARCH64_FEATURE_1_BTI (1U << 0) #define GNU_PROPERTY_AARCH64_FEATURE_1_PAC (1U << 1) +#define GNU_PROPERTY_AARCH64_FEATURE_1_GCS (1U << 2) /* Values used in GNU .note.ABI-tag notes (NT_GNU_ABI_TAG). */ #define GNU_ABI_TAG_LINUX 0 -- cgit v1.1