llvm-project/clang/test/CodeGen/ptrauth-weak_import.c
Ahmed Bougacha e23250ecb7
[clang] Implement function pointer signing and authenticated function calls (#93906)
The functions are currently always signed/authenticated with zero
discriminator.

Co-Authored-By: John McCall <rjmccall@apple.com>
2024-06-21 10:20:15 -07:00

13 lines
467 B
C

// RUN: %clang_cc1 -triple arm64-apple-ios -fptrauth-calls -fptrauth-intrinsics -emit-llvm %s -o - | FileCheck %s
// RUN: %clang_cc1 -triple aarch64-linux-gnu -fptrauth-calls -fptrauth-intrinsics -emit-llvm %s -o - | FileCheck %s
extern void foo() __attribute__((weak_import));
// CHECK: define {{(dso_local )?}}void @bar()
// CHECK: [[TMP1:%.*]] = icmp ne ptr ptrauth (ptr @foo, i32 0), null
// CHECK: br i1 [[TMP1]], label
void bar() {
if (foo)
foo();
}