|
| 1 | +// REQUIRES: target={{x86_64.*-linux.*}} |
| 2 | + |
| 3 | +// RUN: %clang -E -fvisibility=hidden -flto -fno-sanitize-ignorelist -fsanitize=cfi -c %s -o - | FileCheck %s --check-prefix=CHECK-CFI |
| 4 | +// RUN: %clang -E -fvisibility=hidden -flto -fno-sanitize-ignorelist -fsanitize=cfi -fsanitize-cfi-cross-dso -c %s -o - | FileCheck %s --check-prefix=CHECK-CFI |
| 5 | +// RUN: %clang -E -fvisibility=hidden -flto -fno-sanitize-ignorelist -fsanitize=cfi -fno-sanitize=cfi-nvcall,cfi-vcall,cfi-mfcall,cfi-icall -c %s -o - | FileCheck %s --check-prefix=CHECK-CFI |
| 6 | +// CHECK-CFI: CFISanitizerEnabled |
| 7 | + |
| 8 | +// RUN: %clang -E -c %s -o - | FileCheck %s --check-prefix=CHECK-NO-CFI |
| 9 | +// CHECK-NO-CFI: CFISanitizerDisabled |
| 10 | + |
| 11 | +// RUN: %clang -E -fsanitize=kcfi -c %s -o - | FileCheck %s --check-prefixes=CHECK-KCFI,CHECK-NO-CFI |
| 12 | +// CHECK-KCFI: KCFISanitizerEnabled |
| 13 | + |
| 14 | +// RUN: %clang -E -fsanitize=cfi-cast-strict -c %s -o - | FileCheck %s --check-prefix=CHECK-CFI-CAST-STRICT |
| 15 | +// CHECK-CFI-CAST-STRICT: CFICastStrictSanitizerEnabled |
| 16 | + |
| 17 | +// RUN: %clang -E -fvisibility=hidden -flto -fno-sanitize-ignorelist -fsanitize=cfi-derived-cast -c %s -o - | FileCheck %s --check-prefixes=CHECK-CFI,CHECK-CFI-DERIVED-CAST |
| 18 | +// CHECK-CFI-DERIVED-CAST: CFIDerivedCastSanitizerEnabled |
| 19 | + |
| 20 | +// RUN: %clang -E -fvisibility=hidden -flto -fno-sanitize-ignorelist -fsanitize=cfi-icall -c %s -o - | FileCheck %s --check-prefixes=CHECK-CFI,CHECK-CFI-ICALL |
| 21 | +// CHECK-CFI-ICALL: CFIICallSanitizerEnabled |
| 22 | + |
| 23 | +// RUN: %clang -E -fvisibility=hidden -flto -fno-sanitize-ignorelist -fsanitize=cfi-mfcall -c %s -o - | FileCheck %s --check-prefixes=CHECK-CFI,CHECK-CFI-MFCALL |
| 24 | +// CHECK-CFI-MFCALL: CFIMFCallSanitizerEnabled |
| 25 | + |
| 26 | +// RUN: %clang -E -fvisibility=hidden -flto -fno-sanitize-ignorelist -fsanitize=cfi-unrelated-cast -c %s -o - | FileCheck %s --check-prefixes=CHECK-CFI,CHECK-CFI-UNRELATED-CAST |
| 27 | +// CHECK-CFI-UNRELATED-CAST: CFIUnrelatedCastSanitizerEnabled |
| 28 | + |
| 29 | +// RUN: %clang -E -fvisibility=hidden -flto -fno-sanitize-ignorelist -fsanitize=cfi-nvcall -c %s -o - | FileCheck %s --check-prefixes=CHECK-CFI,CHECK-CFI-NVCALL |
| 30 | +// CHECK-CFI-NVCALL: CFINVCallSanitizerEnabled |
| 31 | + |
| 32 | +// RUN: %clang -E -fvisibility=hidden -flto -fno-sanitize-ignorelist -fsanitize=cfi-vcall -c %s -o - | FileCheck %s --check-prefixes=CHECK-CFI,CHECK-CFI-VCALL |
| 33 | +// CHECK-CFI-VCALL: CFIVCallSanitizerEnabled |
| 34 | + |
| 35 | +#if __has_feature(cfi_sanitizer) |
| 36 | +int CFISanitizerEnabled(); |
| 37 | +#else |
| 38 | +int CFISanitizerDisabled(); |
| 39 | +#endif |
| 40 | + |
| 41 | +#if __has_feature(kcfi) |
| 42 | +int KCFISanitizerEnabled(); |
| 43 | +#else |
| 44 | +int KCFISanitizerDisabled(); |
| 45 | +#endif |
| 46 | + |
| 47 | +#if __has_feature(cfi_cast_strict_sanitizer) |
| 48 | +int CFICastStrictSanitizerEnabled(); |
| 49 | +#else |
| 50 | +int CFICastStrictSanitizerDisabled(); |
| 51 | +#endif |
| 52 | + |
| 53 | +#if __has_feature(cfi_derived_cast_sanitizer) |
| 54 | +int CFIDerivedCastSanitizerEnabled(); |
| 55 | +#else |
| 56 | +int CFIDerivedCastSanitizerDisabled(); |
| 57 | +#endif |
| 58 | + |
| 59 | +#if __has_feature(cfi_icall_sanitizer) |
| 60 | +int CFIICallSanitizerEnabled(); |
| 61 | +#else |
| 62 | +int CFIICallSanitizerDisabled(); |
| 63 | +#endif |
| 64 | + |
| 65 | +#if __has_feature(cfi_mfcall_sanitizer) |
| 66 | +int CFIMFCallSanitizerEnabled(); |
| 67 | +#else |
| 68 | +int CFIMFCallSanitizerDisabled(); |
| 69 | +#endif |
| 70 | + |
| 71 | +#if __has_feature(cfi_unrelated_cast_sanitizer) |
| 72 | +int CFIUnrelatedCastSanitizerEnabled(); |
| 73 | +#else |
| 74 | +int CFIUnrelatedCastSanitizerDisabled(); |
| 75 | +#endif |
| 76 | + |
| 77 | +#if __has_feature(cfi_nvcall_sanitizer) |
| 78 | +int CFINVCallSanitizerEnabled(); |
| 79 | +#else |
| 80 | +int CFINVCallSanitizerDisabled(); |
| 81 | +#endif |
| 82 | + |
| 83 | +#if __has_feature(cfi_vcall_sanitizer) |
| 84 | +int CFIVCallSanitizerEnabled(); |
| 85 | +#else |
| 86 | +int CFIVCallSanitizerDisabled(); |
| 87 | +#endif |
0 commit comments