[libunwind] [libunwind] Add GCS support for AArch64 (PR #99335)

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 17 22:26:59 PDT 2024


================
@@ -35,6 +35,25 @@
   } while (0)
 #endif
 
+// On AArch64 we use _LIBUNWIND_USE_CET to indicate that GCS is supported. We
+// need to guard any use of GCS instructions with __chkfeat though, as GCS may
+// not be enabled.
+#if defined(_LIBUNWIND_TARGET_AARCH64) && defined(__ARM_FEATURE_GCS_DEFAULT)
+#define _LIBUNWIND_USE_CET 1
+#include <arm_acle.h>
+
+#define _LIBUNWIND_POP_CET_SSP(x)                                              \
+  do {                                                                         \
+    if (__chkfeat(_CHKFEAT_GCS)) {                                             \
+      unsigned int tmp = (x);                                                  \
----------------
MaskRay wrote:

remove `int`

https://github.com/llvm/llvm-project/pull/99335


More information about the cfe-commits mailing list