================
@@ -90,6 +90,18 @@
   } while (0)
 #endif
 
+// There is not currently a clean way to cast between an authenticated
+// integer and an authenticated function pointer, so we need this helper
+// function to keep things clean.
+static _Unwind_Personality_Fn get_handler_function(unw_proc_info_t *frameInfo) 
{
+  union {
+    void *opaque_handler;
+    _Unwind_Personality_Fn __ptrauth_unwind_upi_handler *handler;
+  } u;
+  u.opaque_handler = (void *)&frameInfo->handler;
+  return *u.handler;
----------------
kovdan01 wrote:

While this should be valid in C, in C++ reading from the member of the union 
that wasn't most recently written is technically UB: 
https://en.cppreference.com/w/cpp/language/union.html.

I think we need to conform to C++ standard and use smth like `memcpy` for doing 
such a trick.

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

Reply via email to