[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 Jun 18 09:27:25 PDT 2025
================
@@ -30,6 +30,46 @@ EXCEPTION_DISPOSITION _GCC_specific_handler(PEXCEPTION_RECORD, void *, PCONTEXT,
_Unwind_Personality_Fn);
#endif
+#if __has_include(<ptrauth.h>)
+#include <ptrauth.h>
+#endif
+
+#if defined(__APPLE__) && __has_feature(ptrauth_qualifier)
----------------
atrosinenko wrote:
I am building this for `aarch64-linux-pauthtest` now and I wonder if it is beneficial to decrease the number of hardcoded `defined(__APPLE__)` guards? Something like
```cpp
#if defined(__APPLE__)
#define EXTRA_PTRAUTH_HARDENING 1
#else
#define EXTRA_PTRAUTH_HARDENING 0
#endif
```
near the top of the file and then use `EXTRA_PTRAUTH_HARDENING` throughout the code instead of `defined(__APPLE__)`, so that other platforms can opt-in to this hardening by adjusting a single line.
Though, the above `EXTRA_PTRAUTH_HARDENING` macro still have to be defined multiple times: separate definitions would probably be required for `compiler-rt/lib/builtins/gcc_personality_v0.c`, `libcxxabi` and `libunwind`.
https://github.com/llvm/llvm-project/pull/143230
More information about the llvm-commits
mailing list