Skip to content

Commit fe9751f

Browse files
committed
ARM64: Add GCS support in assembly code
The GCS support is properly enabled as seen with the following command: $ readelf -n build/libleancrypto.so Displaying notes found in: .note.gnu.property Owner Data size Description GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0 Properties: AArch64 feature: BTI, PAC, GCS Signed-off-by: Stephan Mueller <smueller@chronox.de>
1 parent 8a018c8 commit fe9751f

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

CHANGES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ Changes 1.6.1-prerelease
77

88
* Fix some side channel test failures (all failures are due to test case issues, and no real problems)
99

10+
* AARCH64: enable GCS support (see https://community.arm.com/arm-community-blogs/b/tools-software-ides-blog/posts/gcc-15-continuously-improving#guarded and https://docs.kernel.org/next/arch/arm64/gcs.html)
11+
1012
Changes 1.6.0
1113
* ASN.1: use stack for small generator for small use cases
1214

internal/api/assembler_support.h

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,21 @@
7373
# define GNU_PROPERTY_AARCH64_POINTER_AUTH 0
7474
# endif
7575

76+
# if defined(__ARM_FEATURE_GCS_DEFAULT) && __ARM_FEATURE_GCS_DEFAULT == 1
77+
# define GNU_PROPERTY_AARCH64_GCS (1<<2)
78+
# else
79+
# define GNU_PROPERTY_AARCH64_GCS 0 /* No GCS */
80+
# endif
81+
7682
/* Add the BTI / PAC support to GNU Notes section */
77-
# if GNU_PROPERTY_AARCH64_BTI != 0 || GNU_PROPERTY_AARCH64_POINTER_AUTH != 0
83+
# if GNU_PROPERTY_AARCH64_BTI != 0 || \
84+
GNU_PROPERTY_AARCH64_POINTER_AUTH != 0 || \
85+
GNU_PROPERTY_AARCH64_GCS != 0
7886
# define LC_GNU_PROPERTY_ALIGN 3 /* 2 on 32 bit systems, which we do not cover here */
7987
# define LC_GNU_PROPERTY_TYPE 0xc0000000
80-
# define LC_GNU_PROPERTY_DATA (GNU_PROPERTY_AARCH64_BTI|GNU_PROPERTY_AARCH64_POINTER_AUTH)
88+
# define LC_GNU_PROPERTY_DATA (GNU_PROPERTY_AARCH64_BTI | \
89+
GNU_PROPERTY_AARCH64_POINTER_AUTH | \
90+
GNU_PROPERTY_AARCH64_GCS)
8191
# endif
8292
#endif
8393

0 commit comments

Comments
 (0)