[clang] [clang] Ensure pointers passed to runtime support functions are correctly signed (PR #98276)

Oliver Hunt via cfe-commits cfe-commits at lists.llvm.org
Sun Jul 14 14:42:13 PDT 2024


================
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -triple arm64-apple-ios -fptrauth-calls -fcxx-exceptions -emit-llvm %s -o - | FileCheck %s
+
+class Foo {
+ public:
+  ~Foo() {
+  }
+};
+
+// CHECK-LABEL: define void @_Z1fv()
+// CHECK:  call void @__cxa_throw(ptr %{{.*}}, ptr @_ZTI3Foo, ptr ptrauth (ptr @_ZN3FooD1Ev, i32 0))
+void f() {
+  throw Foo();
+}
+
+// __cxa_throw is defined to take its destructor as "void (*)(void *)" in the ABI.
+// CHECK-LABEL: define void @__cxa_throw({{.*}})
+// CHECK:  call void {{%.*}}(ptr noundef {{%.*}}) [ "ptrauth"(i32 0, i64 0) ]
----------------
ojhunt wrote:

Agreed, I had to actually remove that from the test because that PR had not landed

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


More information about the cfe-commits mailing list