================ @@ -0,0 +1,21 @@ +// RUN: %clang_cc1 -triple arm64-apple-ios -fptrauth-intrinsics -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple aarch64-elf -fptrauth-intrinsics -emit-llvm %s -o - | FileCheck %s + +extern int external; + +// CHECK: @ptr1 = global ptr ptrauth (ptr @external, i32 0, i64 26) +void *ptr1 = __builtin_ptrauth_sign_constant(&external, 0, 26); + +// CHECK: @ptr2 = global ptr ptrauth (ptr @external, i32 2, i64 26, ptr @ptr2) +void *ptr2 = __builtin_ptrauth_sign_constant(&external, 2, __builtin_ptrauth_blend_discriminator(&ptr2, 26)); + +// CHECK: @ptr3 = global ptr null +void *ptr3; ---------------- kovdan01 wrote:
Feel free to ignore: probably worth adding test for smth like ``` void *ptr4 = __builtin_ptrauth_sign_constant(&external, 0, NULL); ``` This doesn't bring that much value over testing a non-null constant integer discriminator, but: 1. In docs, having null pointer as a discriminator is listed as a separate option > This is a constant expression if the extra data is an integer or null pointer constant. 2. With `NULL` defined as `#define NULL ((void*) 0)`, we'll explicitly test having a constant pointer, not an integer, value as a discriminator https://github.com/llvm/llvm-project/pull/93904 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits