[compiler-rt] [libcxxabi] [libunwind] [runtimes][PAC] Harden unwinding when possible (#138571) (PR #143230)

Anatoly Trosinenko via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 6 12:51:01 PDT 2025


================
@@ -103,6 +103,52 @@
 #define _LIBCXXABI_DTOR_FUNC
 #endif
 
+#if __has_include(<ptrauth.h>)
+#  include <ptrauth.h>
+#endif
----------------
atrosinenko wrote:

I wonder if it is a supported configuration when `ptrauth.h` header is not available, but `__has_extension(ptrauth_qualifier)` is true? Note that the macro definitions guarded with `#if __has_extension(ptrauth_qualifier)` still refer to identifiers like `ptrauth_key_process_dependent_data`.

Maybe this could be simplified by assuming that `__ptrauth_cxxabi_*` are defined to non-empty expressions if and only if `__has_extension(ptrauth_qualifier)` is true, and in that case `ptrauth.h` header must exist:
```cpp
#if __has_extension(ptrauth_qualifier)
#  include <ptrauth.h>
// ptrauth_string_discriminator("__cxa_exception::actionRecord") == 0xFC91
#  define __ptrauth_cxxabi_action_record \
            __ptrauth(ptrauth_key_process_dependent_data, 1, 0xFC91)
// ...
#endif
```

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


More information about the llvm-commits mailing list