================
@@ -30,6 +30,50 @@ EXCEPTION_DISPOSITION 
_GCC_specific_handler(PEXCEPTION_RECORD, void *, PCONTEXT,
                                             _Unwind_Personality_Fn);
 #endif
 
+#if __has_feature(ptrauth_qualifier)
+#include <ptrauth.h>
+#endif
+
+#if defined(__APPLE__) && __has_feature(ptrauth_qualifier)
+#if __has_feature(ptrauth_restricted_intptr_qualifier)
+#define __ptrauth_gcc_personality_intptr(key, addressDiscriminated,            
\
+                                              discriminator)                   
\
+  __ptrauth_restricted_intptr(key, addressDiscriminated, discriminator)
+#else
+#define __ptrauth_gcc_personality_intptr(key, addressDiscriminated,            
\
+                                              discriminator)                   
\
+  __ptrauth(key, addressDiscriminated, discriminator)
+#endif
+#else
+#define __ptrauth_gcc_personality_intptr(...)
+#endif
+
+// The actual value of the discriminators listed below is not important.
+// The derivation of the constants is only being included for the purpose
+// of maintaining a record of how they were originally produced.
+
+// ptrauth_string_discriminator("__gcc_personality_v0'funcStart") == 0xDFEB
+#define __ptrauth_gcc_personality_func_start \
----------------
atrosinenko wrote:

This macro has `__ptrauth_gcc_personality_` prefix while some other ones have a 
shorter `__ptrauth_gcc_` prefix - is this intentional? If not and if the longer 
`gcc_personality` version was intended, I think it may be worth coming up with 
a shorter prefix to keep variable definitions single-line. On the other hand, 
it is still hard to keep most of the definitions single-line even with 
`__ptrauth_gcc_` prefix.

By the way, do we need two underscores in front of our own macro definitions 
(at least as long as they are completely private)? Are there any code style 
suggestions for or against this?

https://github.com/llvm/llvm-project/pull/143230
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to