Files
TheRock/compiler/amd-llvm/clang/test/CodeGen/ptrauth-qualifier-const-init.c
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

87 lines
3.9 KiB
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
// Constant initializers for data pointers.
extern int external_int;
// CHECK: @g1 = global ptr ptrauth (ptr @external_int, i32 1, i64 56)
int * __ptrauth(1,0,56) g1 = &external_int;
// CHECK: @g2 = global ptr ptrauth (ptr @external_int, i32 1, i64 1272, ptr @g2)
int * __ptrauth(1,1,1272) g2 = &external_int;
// CHECK: @g3 = global ptr null
int * __ptrauth(1,1,871) g3 = 0;
// FIXME: should we make a ptrauth constant for this absolute symbol?
// CHECK: @g4 = global ptr inttoptr (i64 1230 to ptr)
int * __ptrauth(1,1,1902) g4 = (int*) 1230;
// CHECK: @ga = global [3 x ptr] [
// CHECK-SAME: ptr ptrauth (ptr @external_int, i32 1, i64 712, ptr @ga),
// CHECK-SAME: ptr ptrauth (ptr @external_int, i32 1, i64 712, ptr getelementptr inbounds ([3 x ptr], ptr @ga, i32 0, i32 1)),
// CHECK-SAME: ptr ptrauth (ptr @external_int, i32 1, i64 712, ptr getelementptr inbounds ([3 x ptr], ptr @ga, i32 0, i32 2))]
int * __ptrauth(1,1,712) ga[3] = { &external_int, &external_int, &external_int };
struct A {
int * __ptrauth(1,0,431) f0;
int * __ptrauth(1,0,9182) f1;
int * __ptrauth(1,0,783) f2;
};
// CHECK: @gs1 = global %struct.A {
// CHECK-SAME: ptr ptrauth (ptr @external_int, i32 1, i64 431),
// CHECK-SAME: ptr ptrauth (ptr @external_int, i32 1, i64 9182),
// CHECK-SAME: ptr ptrauth (ptr @external_int, i32 1, i64 783) }
struct A gs1 = { &external_int, &external_int, &external_int };
struct B {
int * __ptrauth(1,1,1276) f0;
int * __ptrauth(1,1,23674) f1;
int * __ptrauth(1,1,163) f2;
};
// CHECK: @gs2 = global %struct.B {
// CHECK-SAME: ptr ptrauth (ptr @external_int, i32 1, i64 1276, ptr @gs2),
// CHECK-SAME: ptr ptrauth (ptr @external_int, i32 1, i64 23674, ptr getelementptr inbounds (%struct.B, ptr @gs2, i32 0, i32 1)),
// CHECK-SAME: ptr ptrauth (ptr @external_int, i32 1, i64 163, ptr getelementptr inbounds (%struct.B, ptr @gs2, i32 0, i32 2)) }
struct B gs2 = { &external_int, &external_int, &external_int };
// Constant initializers for function pointers.
extern void external_function(void);
typedef void (*fpt)(void);
// CHECK: @f1 = global ptr ptrauth (ptr @external_function, i32 1, i64 56)
fpt __ptrauth(1,0,56) f1 = &external_function;
// CHECK: @f2 = global ptr ptrauth (ptr @external_function, i32 1, i64 1272, ptr @f2)
fpt __ptrauth(1,1,1272) f2 = &external_function;
// CHECK: @fa = global [3 x ptr] [
// CHECK-SAME: ptr ptrauth (ptr @external_function, i32 1, i64 712, ptr @fa),
// CHECK-SAME: ptr ptrauth (ptr @external_function, i32 1, i64 712, ptr getelementptr inbounds ([3 x ptr], ptr @fa, i32 0, i32 1)),
// CHECK-SAME: ptr ptrauth (ptr @external_function, i32 1, i64 712, ptr getelementptr inbounds ([3 x ptr], ptr @fa, i32 0, i32 2))]
fpt __ptrauth(1,1,712) fa[3] = { &external_function, &external_function, &external_function };
struct C {
fpt __ptrauth(1,0,431) f0;
fpt __ptrauth(1,0,9182) f1;
fpt __ptrauth(1,0,783) f2;
};
// CHECK: @fs1 = global %struct.C {
// CHECK-SAME: ptr ptrauth (ptr @external_function, i32 1, i64 431),
// CHECK-SAME: ptr ptrauth (ptr @external_function, i32 1, i64 9182),
// CHECK-SAME: ptr ptrauth (ptr @external_function, i32 1, i64 783) }
struct C fs1 = { &external_function, &external_function, &external_function };
struct D {
fpt __ptrauth(1,1,1276) f0;
fpt __ptrauth(1,1,23674) f1;
fpt __ptrauth(1,1,163) f2;
};
// CHECK: @fs2 = global %struct.D {
// CHECK-SAME: ptr ptrauth (ptr @external_function, i32 1, i64 1276, ptr @fs2),
// CHECK-SAME: ptr ptrauth (ptr @external_function, i32 1, i64 23674, ptr getelementptr inbounds (%struct.D, ptr @fs2, i32 0, i32 1)),
// CHECK-SAME: ptr ptrauth (ptr @external_function, i32 1, i64 163, ptr getelementptr inbounds (%struct.D, ptr @fs2, i32 0, i32 2)) }
struct D fs2 = { &external_function, &external_function, &external_function };