| 1 |
// REQUIRES: aarch64-registered-target |
| 2 |
|
| 3 |
// RUN: %clang -### -c --target=aarch64 %s 2>&1 | FileCheck %s --check-prefix NONE |
| 4 |
// NONE: "-cc1" |
| 5 |
// NONE-NOT: "-fptrauth- |
| 6 |
|
| 7 |
// RUN: %clang -### -c --target=aarch64 \ |
| 8 |
// RUN: -fno-ptrauth-intrinsics -fptrauth-intrinsics \ |
| 9 |
// RUN: -fno-ptrauth-calls -fptrauth-calls \ |
| 10 |
// RUN: -fno-ptrauth-returns -fptrauth-returns \ |
| 11 |
// RUN: -fno-ptrauth-auth-traps -fptrauth-auth-traps \ |
| 12 |
// RUN: -fno-ptrauth-vtable-pointer-address-discrimination -fptrauth-vtable-pointer-address-discrimination \ |
| 13 |
// RUN: -fno-ptrauth-vtable-pointer-type-discrimination -fptrauth-vtable-pointer-type-discrimination \ |
| 14 |
// RUN: -fno-ptrauth-type-info-vtable-pointer-discrimination -fptrauth-type-info-vtable-pointer-discrimination \ |
| 15 |
// RUN: -fno-ptrauth-init-fini -fptrauth-init-fini \ |
| 16 |
// RUN: -fno-ptrauth-indirect-gotos -fptrauth-indirect-gotos \ |
| 17 |
// RUN: %s 2>&1 | FileCheck %s --check-prefix=ALL |
| 18 |
// ALL: "-cc1"{{.*}} "-fptrauth-intrinsics" "-fptrauth-calls" "-fptrauth-returns" "-fptrauth-auth-traps" "-fptrauth-vtable-pointer-address-discrimination" "-fptrauth-vtable-pointer-type-discrimination" "-fptrauth-type-info-vtable-pointer-discrimination" "-fptrauth-init-fini" "-fptrauth-indirect-gotos" |
| 19 |
|
| 20 |
// RUN: %clang -### -c --target=aarch64-linux -mabi=pauthtest %s 2>&1 | FileCheck %s --check-prefix=PAUTHABI1 |
| 21 |
// RUN: %clang -### -c --target=aarch64-linux-pauthtest %s 2>&1 | FileCheck %s --check-prefix=PAUTHABI1 |
| 22 |
// PAUTHABI1: "-cc1"{{.*}} "-triple" "aarch64-unknown-linux-pauthtest" |
| 23 |
// PAUTHABI1-SAME: "-target-abi" "pauthtest" |
| 24 |
// PAUTHABI1-SAME: "-fptrauth-intrinsics" "-fptrauth-calls" "-fptrauth-returns" "-fptrauth-auth-traps" "-fptrauth-vtable-pointer-address-discrimination" "-fptrauth-vtable-pointer-type-discrimination" "-fptrauth-indirect-gotos" "-fptrauth-init-fini" |
| 25 |
|
| 26 |
// RUN: %clang -### -c --target=aarch64 -mabi=pauthtest -fno-ptrauth-intrinsics \ |
| 27 |
// RUN: -fno-ptrauth-calls -fno-ptrauth-returns -fno-ptrauth-auth-traps \ |
| 28 |
// RUN: -fno-ptrauth-vtable-pointer-address-discrimination -fno-ptrauth-vtable-pointer-type-discrimination \ |
| 29 |
// RUN: -fno-ptrauth-indirect-gotos -fno-ptrauth-init-fini %s 2>&1 | FileCheck %s --check-prefix=PAUTHABI2 |
| 30 |
// RUN: %clang -### -c --target=aarch64-pauthtest -fno-ptrauth-intrinsics \ |
| 31 |
// RUN: -fno-ptrauth-calls -fno-ptrauth-returns -fno-ptrauth-auth-traps \ |
| 32 |
// RUN: -fno-ptrauth-vtable-pointer-address-discrimination -fno-ptrauth-vtable-pointer-type-discrimination \ |
| 33 |
// RUN: -fno-ptrauth-indirect-gotos -fno-ptrauth-init-fini %s 2>&1 | FileCheck %s --check-prefix=PAUTHABI2 |
| 34 |
// PAUTHABI2: "-cc1" |
| 35 |
// PAUTHABI2-NOT: "-fptrauth- |
| 36 |
|
| 37 |
// RUN: not %clang -### -c --target=x86_64 -fptrauth-intrinsics -fptrauth-calls -fptrauth-returns -fptrauth-auth-traps \ |
| 38 |
// RUN: -fptrauth-vtable-pointer-address-discrimination -fptrauth-vtable-pointer-type-discrimination \ |
| 39 |
// RUN: -fptrauth-type-info-vtable-pointer-discrimination -fptrauth-indirect-gotos -fptrauth-init-fini %s 2>&1 | \ |
| 40 |
// RUN: FileCheck %s --check-prefix=ERR1 |
| 41 |
// ERR1: error: unsupported option '-fptrauth-intrinsics' for target '{{.*}}' |
| 42 |
// ERR1-NEXT: error: unsupported option '-fptrauth-calls' for target '{{.*}}' |
| 43 |
// ERR1-NEXT: error: unsupported option '-fptrauth-returns' for target '{{.*}}' |
| 44 |
// ERR1-NEXT: error: unsupported option '-fptrauth-auth-traps' for target '{{.*}}' |
| 45 |
// ERR1-NEXT: error: unsupported option '-fptrauth-vtable-pointer-address-discrimination' for target '{{.*}}' |
| 46 |
// ERR1-NEXT: error: unsupported option '-fptrauth-vtable-pointer-type-discrimination' for target '{{.*}}' |
| 47 |
// ERR1-NEXT: error: unsupported option '-fptrauth-type-info-vtable-pointer-discrimination' for target '{{.*}}' |
| 48 |
// ERR1-NEXT: error: unsupported option '-fptrauth-indirect-gotos' for target '{{.*}}' |
| 49 |
// ERR1-NEXT: error: unsupported option '-fptrauth-init-fini' for target '{{.*}}' |
| 50 |
|
| 51 |
//// Only support PAuth ABI for Linux as for now. |
| 52 |
// RUN: not %clang -c --target=aarch64-unknown -mabi=pauthtest %s 2>&1 | FileCheck %s --check-prefix=ERR2 |
| 53 |
// RUN: not %clang -c --target=aarch64-unknown-pauthtest %s 2>&1 | FileCheck %s --check-prefix=ERR2 |
| 54 |
// ERR2: error: ABI 'pauthtest' is not supported for 'aarch64-unknown-unknown-pauthtest' |
| 55 |
|
| 56 |
//// PAuth ABI is encoded as environment part of the triple, so don't allow to explicitly set other environments. |
| 57 |
// RUN: not %clang -c --target=aarch64-linux-gnu -mabi=pauthtest %s 2>&1 | FileCheck %s --check-prefix=ERR3 |
| 58 |
// ERR3: error: unsupported option '-mabi=pauthtest' for target 'aarch64-unknown-linux-gnu' |
| 59 |
// RUN: %clang -c --target=aarch64-linux-pauthtest -mabi=pauthtest %s |
| 60 |
|
| 61 |
//// The only branch protection option compatible with PAuthABI is BTI. |
| 62 |
// RUN: not %clang -### -c --target=aarch64-linux -mabi=pauthtest -mbranch-protection=pac-ret %s 2>&1 | \ |
| 63 |
// RUN: FileCheck %s --check-prefix=ERR4 |
| 64 |
// RUN: not %clang -### -c --target=aarch64-linux-pauthtest -mbranch-protection=pac-ret %s 2>&1 | \ |
| 65 |
// RUN: FileCheck %s --check-prefix=ERR4 |
| 66 |
// ERR4: error: unsupported option '-mbranch-protection=pac-ret' for target 'aarch64-unknown-linux-pauthtest' |
| 67 |
|
| 68 |
// RUN: not %clang -### -c --target=aarch64-linux -mabi=pauthtest -mbranch-protection=gcs %s 2>&1 | \ |
| 69 |
// RUN: FileCheck %s --check-prefix=ERR5 |
| 70 |
// RUN: not %clang -### -c --target=aarch64-linux-pauthtest -mbranch-protection=gcs %s 2>&1 | \ |
| 71 |
// RUN: FileCheck %s --check-prefix=ERR5 |
| 72 |
// ERR5: error: unsupported option '-mbranch-protection=gcs' for target 'aarch64-unknown-linux-pauthtest' |
| 73 |
|
| 74 |
// RUN: not %clang -### -c --target=aarch64-linux -mabi=pauthtest -mbranch-protection=standard %s 2>&1 | \ |
| 75 |
// RUN: FileCheck %s --check-prefix=ERR6 |
| 76 |
// RUN: not %clang -### -c --target=aarch64-linux-pauthtest -mbranch-protection=standard %s 2>&1 | \ |
| 77 |
// RUN: FileCheck %s --check-prefix=ERR6 |
| 78 |
// ERR6: error: unsupported option '-mbranch-protection=standard' for target 'aarch64-unknown-linux-pauthtest' |
| 79 |
|
| 80 |
// RUN: not %clang -### -c --target=aarch64-linux -mabi=pauthtest -msign-return-address=all %s 2>&1 | \ |
| 81 |
// RUN: FileCheck %s --check-prefix=ERR7 |
| 82 |
// RUN: not %clang -### -c --target=aarch64-linux-pauthtest -msign-return-address=all %s 2>&1 | \ |
| 83 |
// RUN: FileCheck %s --check-prefix=ERR7 |
| 84 |
// ERR7: error: unsupported option '-msign-return-address=all' for target 'aarch64-unknown-linux-pauthtest' |
| 85 |
|
| 86 |
// RUN: not %clang -### -c --target=aarch64-linux -mabi=pauthtest -msign-return-address=non-leaf %s 2>&1 | \ |
| 87 |
// RUN: FileCheck %s --check-prefix=ERR8 |
| 88 |
// RUN: not %clang -### -c --target=aarch64-linux-pauthtest -msign-return-address=non-leaf %s 2>&1 | \ |
| 89 |
// RUN: FileCheck %s --check-prefix=ERR8 |
| 90 |
// ERR8: error: unsupported option '-msign-return-address=non-leaf' for target 'aarch64-unknown-linux-pauthtest' |
| 91 |
|
| 92 |
// RUN: %clang -### -c --target=aarch64-linux -mabi=pauthtest -msign-return-address=none %s |
| 93 |
// RUN: %clang -### -c --target=aarch64-linux-pauthtest -msign-return-address=none %s |
| 94 |
// RUN: %clang -### -c --target=aarch64-linux -mabi=pauthtest -mbranch-protection=bti %s |
| 95 |
// RUN: %clang -### -c --target=aarch64-linux-pauthtest -mbranch-protection=bti %s |
| 96 |
// RUN: %clang -### -c --target=aarch64-linux -mabi=pauthtest -mbranch-protection=none %s |
| 97 |
// RUN: %clang -### -c --target=aarch64-linux-pauthtest -mbranch-protection=none %s |