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

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 2 10:28:56 PDT 2024


================
@@ -180,8 +197,13 @@ unwind_phase2(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception *except
   // uc is initialized by __unw_getcontext in the parent frame. The first stack
   // frame walked is unwind_phase2.
   unsigned framesWalked = 1;
-#ifdef _LIBUNWIND_USE_CET
+#if defined(_LIBUNWIND_USE_CET)
   unsigned long shadowStackTop = _get_ssp();
+#elif defined(_LIBUNWIND_USE_GCS)
+  unsigned long shadowStackTop = 0;
+  if (__chkfeat(_CHKFEAT_GCS)) {
+    shadowStackTop = (unsigned long)__gcspr();
----------------
MaskRay wrote:

the brace can be dropped

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


More information about the cfe-commits mailing list