Revert "[llvm] Improve llvm.objectsize computation by computing GEP, alloca and mallo...
[llvm-project.git] / clang / test / CodeGen / ptrauth-init-fini.c
blob1e8953961d64eff7e6069ea43e9c8a482b86ee49
1 // REQUIRES: aarch64-registered-target
3 // RUN: %clang_cc1 -triple aarch64-elf -target-feature +pauth -fptrauth-calls -fptrauth-init-fini \
4 // RUN: -emit-llvm %s -o - | FileCheck --check-prefix=SIGNED %s
6 // RUN: %clang_cc1 -triple aarch64-elf -target-feature +pauth -fptrauth-calls -fptrauth-init-fini \
7 // RUN: -fptrauth-init-fini-address-discrimination -emit-llvm %s -o - | FileCheck --check-prefix=ADDRDISC %s
9 // RUN: %clang_cc1 -triple aarch64-elf -target-feature +pauth -fptrauth-calls \
10 // RUN: -emit-llvm %s -o - | FileCheck --check-prefix=UNSIGNED %s
12 // RUN: %clang_cc1 -triple aarch64-elf -target-feature +pauth -fptrauth-calls -fptrauth-init-fini-address-discrimination \
13 // RUN: -emit-llvm %s -o - | FileCheck --check-prefix=UNSIGNED %s
15 // RUN: %clang_cc1 -triple aarch64-elf -target-feature +pauth -fptrauth-init-fini \
16 // RUN: -emit-llvm %s -o - | FileCheck --check-prefix=UNSIGNED %s
18 // SIGNED: @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 65535, ptr ptrauth (ptr @foo, i32 0, i64 55764), ptr null }]
19 // SIGNED: @llvm.global_dtors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 65535, ptr ptrauth (ptr @bar, i32 0, i64 55764), ptr null }]
21 // ADDRDISC: @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 65535, ptr ptrauth (ptr @foo, i32 0, i64 55764, ptr inttoptr (i64 1 to ptr)), ptr null }]
22 // ADDRDISC: @llvm.global_dtors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 65535, ptr ptrauth (ptr @bar, i32 0, i64 55764, ptr inttoptr (i64 1 to ptr)), ptr null }]
24 // UNSIGNED: @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 65535, ptr @foo, ptr null }]
25 // UNSIGNED: @llvm.global_dtors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 65535, ptr @bar, ptr null }]
27 volatile int x = 0;
29 __attribute__((constructor)) void foo(void) {
30 x = 42;
33 __attribute__((destructor)) void bar(void) {
34 x = 24;
37 int main() {
38 return x;