brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.0 KiB · e6605ce Raw
36 lines · c
1// REQUIRES: aarch64-registered-target2 3// RUN:     %clang -target aarch64-linux-pauthtest   %s -S -emit-llvm -o - 2>&1 | FileCheck --implicit-check-not=warning: %s4// RUN: not %clang -target aarch64 -fptrauth-returns %s -S -emit-llvm -o - 2>&1 | FileCheck --implicit-check-not=warning: --check-prefix=PTRAUTH-RETURNS %s5 6// Clang fails early, no LLVM IR output produced.7// PTRAUTH-RETURNS: clang: error: unsupported option '-fptrauth-returns' for target 'aarch64'8// PTRAUTH-RETURNS-NOT: attributes9 10/// Unsupported with pauthtest, warning emitted11__attribute__((target("branch-protection=pac-ret"))) void f1() {}12// CHECK:      warning: unsupported 'branch-protection' in the 'target' attribute string; 'target' attribute ignored [-Wignored-attributes]13// CHECK-NEXT: __attribute__((target("branch-protection=pac-ret"))) void f1() {}14__attribute__((target("branch-protection=gcs"))) void f2() {}15// CHECK:      warning: unsupported 'branch-protection' in the 'target' attribute string; 'target' attribute ignored [-Wignored-attributes]16// CHECK-NEXT: __attribute__((target("branch-protection=gcs"))) void f2() {}17__attribute__((target("branch-protection=standard"))) void f3() {}18// CHECK:      warning: unsupported 'branch-protection' in the 'target' attribute string; 'target' attribute ignored [-Wignored-attributes]19// CHECK-NEXT: __attribute__((target("branch-protection=standard"))) void f3() {}20 21/// Supported with pauthtest, no warning emitted22__attribute__((target("branch-protection=bti"))) void f4() {}23 24/// Supported with pauthtest, no warning emitted25__attribute__((target("branch-protection=none"))) void f5() {}26 27/// Check there are no branch protection function attributes which are unsupported with pauthtest28 29// CHECK-NOT:  attributes {{.*}} "sign-return-address"30// CHECK-NOT:  attributes {{.*}} "sign-return-address-key"31// CHECK-NOT:  attributes {{.*}} "branch-protection-pauth-lr"32// CHECK-NOT:  attributes {{.*}} "guarded-control-stack"33 34/// Check function attributes which are supported with pauthtest35// CHECK:      attributes {{.*}} "branch-target-enforcement"36