|
| 1 | +// Check that we can manually enable specific ptrauth features. |
| 2 | + |
| 3 | +// RUN: %clang -target arm64-apple-darwin -c %s -### 2>&1 | FileCheck %s --check-prefix NONE |
| 4 | +// NONE: "-cc1" |
| 5 | +// NONE-NOT: "-fptrauth-intrinsics" |
| 6 | +// NONE-NOT: "-fptrauth-calls" |
| 7 | +// NONE-NOT: "-fptrauth-returns" |
| 8 | +// NONE-NOT: "-fptrauth-indirect-gotos" |
| 9 | +// NONE-NOT: "-fptrauth-auth-traps" |
| 10 | + |
| 11 | +// RUN: %clang -target arm64-apple-darwin -fptrauth-calls -c %s -### 2>&1 | FileCheck %s --check-prefix CALL |
| 12 | +// CALL: "-cc1"{{.*}} {{.*}} "-fptrauth-calls" |
| 13 | + |
| 14 | +// RUN: %clang -target arm64-apple-darwin -fptrauth-intrinsics -c %s -### 2>&1 | FileCheck %s --check-prefix INTRIN |
| 15 | +// INTRIN: "-cc1"{{.*}} {{.*}} "-fptrauth-intrinsics" |
| 16 | + |
| 17 | +// RUN: %clang -target arm64-apple-darwin -fptrauth-returns -c %s -### 2>&1 | FileCheck %s --check-prefix RETURN |
| 18 | +// RETURN: "-cc1"{{.*}} {{.*}} "-fptrauth-returns" |
| 19 | + |
| 20 | +// RUN: %clang -target arm64-apple-darwin -fptrauth-indirect-gotos -c %s -### 2>&1 | FileCheck %s --check-prefix INDGOTO |
| 21 | +// INDGOTO: "-cc1"{{.*}} {{.*}} "-fptrauth-indirect-gotos" |
| 22 | + |
| 23 | +// RUN: %clang -target arm64-apple-darwin -fptrauth-auth-traps -c %s -### 2>&1 | FileCheck %s --check-prefix TRAPS |
| 24 | +// TRAPS: "-cc1"{{.*}} {{.*}} "-fptrauth-auth-traps" |
| 25 | + |
| 26 | + |
| 27 | +// Check the arm64e defaults. |
| 28 | + |
| 29 | +// RUN: %clang -target arm64e-apple-ios -c %s -### 2>&1 | FileCheck %s --check-prefix DEFAULT |
| 30 | +// RUN: %clang -mkernel -target arm64e-apple-ios -c %s -### 2>&1 | FileCheck %s --check-prefix DEFAULT |
| 31 | +// RUN: %clang -fapple-kext -target arm64e-apple-ios -c %s -### 2>&1 | FileCheck %s --check-prefix DEFAULT |
| 32 | +// DEFAULT: "-fptrauth-returns" "-fptrauth-intrinsics" "-fptrauth-calls" "-fptrauth-indirect-gotos" "-fptrauth-auth-traps" {{.*}}"-target-cpu" "apple-a12"{{.*}} |
| 33 | + |
| 34 | +// RUN: %clang -target arm64e-apple-none-macho -c %s -### 2>&1 | FileCheck %s --check-prefix DEFAULT-MACHO |
| 35 | +// DEFAULT-MACHO: "-fptrauth-returns" "-fptrauth-intrinsics" "-fptrauth-calls" "-fptrauth-indirect-gotos" "-fptrauth-auth-traps" {{.*}}"-target-cpu" "apple-a12"{{.*}} |
| 36 | + |
| 37 | + |
| 38 | +// RUN: %clang -target arm64e-apple-ios -fno-ptrauth-calls -c %s -### 2>&1 | FileCheck %s --check-prefix DEFAULT-NOCALL |
| 39 | +// RUN: %clang -mkernel -target arm64e-apple-ios -fno-ptrauth-calls -c %s -### 2>&1 | FileCheck %s --check-prefix DEFAULT-NOCALL |
| 40 | +// RUN: %clang -fapple-kext -target arm64e-apple-ios -fno-ptrauth-calls -c %s -### 2>&1 | FileCheck %s --check-prefix DEFAULT-NOCALL |
| 41 | +// DEFAULT-NOCALL-NOT: "-fptrauth-calls" |
| 42 | +// DEFAULT-NOCALL: "-fptrauth-returns" "-fptrauth-intrinsics" "-fptrauth-indirect-gotos" "-fptrauth-auth-traps" {{.*}}"-target-cpu" "apple-a12" |
| 43 | + |
| 44 | + |
| 45 | +// RUN: %clang -target arm64e-apple-ios -fno-ptrauth-returns -c %s -### 2>&1 | FileCheck %s --check-prefix NORET |
| 46 | + |
| 47 | +// NORET-NOT: "-fptrauth-returns" |
| 48 | +// NORET: "-fptrauth-intrinsics" "-fptrauth-calls" "-fptrauth-indirect-gotos" "-fptrauth-auth-traps" {{.*}}"-target-cpu" "apple-a12" |
| 49 | + |
| 50 | +// RUN: %clang -target arm64e-apple-ios -fno-ptrauth-intrinsics -c %s -### 2>&1 | FileCheck %s --check-prefix NOINTRIN |
| 51 | + |
| 52 | +// NOINTRIN: "-fptrauth-returns" |
| 53 | +// NOINTRIN-NOT: "-fptrauth-intrinsics" |
| 54 | +// NOINTRIN: "-fptrauth-calls" "-fptrauth-indirect-gotos" "-fptrauth-auth-traps" {{.*}}"-target-cpu" "apple-a12"{{.*}} |
| 55 | + |
| 56 | + |
| 57 | +// RUN: %clang -target arm64e-apple-ios -fno-ptrauth-auth-traps -c %s -### 2>&1 | FileCheck %s --check-prefix NOTRAP |
| 58 | +// NOTRAP: "-fptrauth-returns" "-fptrauth-intrinsics" "-fptrauth-calls" "-fptrauth-indirect-gotos" {{.*}}"-target-cpu" "apple-a12" |
| 59 | + |
| 60 | + |
| 61 | +// Check the CPU defaults and overrides. |
| 62 | + |
| 63 | +// RUN: %clang -target arm64e-apple-ios -c %s -### 2>&1 | FileCheck %s --check-prefix APPLE-A12 |
| 64 | +// RUN: %clang -target arm64e-apple-ios -mcpu=apple-a13 -c %s -### 2>&1 | FileCheck %s --check-prefix APPLE-A13 |
| 65 | +// APPLE-A12: "-cc1"{{.*}} "-target-cpu" "apple-a12" |
| 66 | +// APPLE-A13: "-cc1"{{.*}} "-target-cpu" "apple-a13" |
0 commit comments