Skip to content

Commit c649194

Browse files
[libunwind] Be more careful about enabling GCS (#101973)
We need both GCS to be enabled by the compiler (which we do by checking if __ARM_FEATURE_GCS_DEFAULT is defined) and for arm_acle.h to define the GCS intrinsics. Check the latter by checking if _CHKFEAT_GCS is defined.
1 parent 83d9ed2 commit c649194

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

libunwind/src/cet_unwind.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,13 @@
3939
// need to guard any use of GCS instructions with __chkfeat though, as GCS may
4040
// not be enabled.
4141
#if defined(_LIBUNWIND_TARGET_AARCH64) && defined(__ARM_FEATURE_GCS_DEFAULT)
42-
#define _LIBUNWIND_USE_GCS 1
4342
#include <arm_acle.h>
4443

44+
// We can only use GCS if arm_acle.h defines the GCS intrinsics.
45+
#ifdef _CHKFEAT_GCS
46+
#define _LIBUNWIND_USE_GCS 1
47+
#endif
48+
4549
#define _LIBUNWIND_POP_CET_SSP(x) \
4650
do { \
4751
if (__chkfeat(_CHKFEAT_GCS)) { \

0 commit comments

Comments
 (0)