brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.0 KiB · 1e89539 Raw
40 lines · c
1// REQUIRES: aarch64-registered-target2 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 %s5 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 %s8 9// RUN: %clang_cc1 -triple aarch64-elf -target-feature +pauth -fptrauth-calls \10// RUN:   -emit-llvm %s -o - | FileCheck --check-prefix=UNSIGNED %s11 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 %s14 15// RUN: %clang_cc1 -triple aarch64-elf -target-feature +pauth                 -fptrauth-init-fini    \16// RUN:   -emit-llvm %s -o - | FileCheck --check-prefix=UNSIGNED %s17 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 }]20 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 }]23 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 }]26 27volatile int x = 0;28 29__attribute__((constructor)) void foo(void) {30  x = 42;31}32 33__attribute__((destructor)) void bar(void) {34  x = 24;35}36 37int main() {38  return x;39}40