| 1 |
// * Test BareMetal toolchain sanitizer support * |
| 2 |
|
| 3 |
// RUN: %clang --target=arm-arm-non-eabi -fsanitize=address %s -### 2>&1 | FileCheck %s -check-prefix=ADDRESS-BAREMETAL |
| 4 |
// RUN: %clang --target=aarch64-none-elf -fsanitize=address %s -### 2>&1 | FileCheck %s -check-prefix=ADDRESS-BAREMETAL |
| 5 |
// ADDRESS-BAREMETAL: "-fsanitize=address" |
| 6 |
|
| 7 |
// RUN: %clang --target=arm-arm-none-eabi -fsanitize=kernel-address %s -### 2>&1 | FileCheck %s -check-prefix=KERNEL-ADDRESS-BAREMETAL |
| 8 |
// RUN: %clang --target=aarch64-none-elf -fsanitize=kernel-address %s -### 2>&1 | FileCheck %s -check-prefix=KERNEL-ADDRESS-BAREMETAL |
| 9 |
// KERNEL-ADDRESS-BAREMETAL: "-fsanitize=kernel-address" |
| 10 |
|
| 11 |
// RUN: %clang --target=aarch64-none-elf -fsanitize=hwaddress %s -### 2>&1 | FileCheck %s -check-prefix=HWADDRESS-BAREMETAL |
| 12 |
// HWADDRESS-BAREMETAL: "-fsanitize=hwaddress" |
| 13 |
|
| 14 |
// RUN: %clang --target=aarch64-none-elf -fsanitize=kernel-hwaddress %s -### 2>&1 | FileCheck %s -check-prefix=KERNEL-HWADDRESS-BAREMETAL |
| 15 |
// KERNEL-HWADDRESS-BAREMETAL: "-fsanitize=kernel-hwaddress" |
| 16 |
|
| 17 |
// RUN: %clang --target=aarch64-none-elf -fsanitize=thread %s -### 2>&1 | FileCheck %s -check-prefix=THREAD-BAREMETAL |
| 18 |
// THREAD-BAREMETAL: "-fsanitize=thread" |
| 19 |
|
| 20 |
// RUN: %clang --target=arm-arm-none-eabi -fsanitize=vptr %s -### 2>&1 | FileCheck %s -check-prefix=VPTR-BAREMETAL |
| 21 |
// RUN: %clang --target=aarch64-none-elf -fsanitize=vptr %s -### 2>&1 | FileCheck %s -check-prefix=VPTR-BAREMETAL |
| 22 |
// VPTR-BAREMETAL: "-fsanitize=vptr" |
| 23 |
|
| 24 |
// RUN: %clang --target=arm-arm-none-eabi -fsanitize=safe-stack %s -### 2>&1 | FileCheck %s -check-prefix=SAFESTACK-BAREMETAL |
| 25 |
// RUN: %clang --target=aarch64-none-elf -fsanitize=safe-stack %s -### 2>&1 | FileCheck %s -check-prefix=SAFESTACK-BAREMETAL |
| 26 |
// SAFESTACK-BAREMETAL: "-fsanitize=safe-stack" |
| 27 |
|
| 28 |
// RUN: %clang --target=arm-arm-none-eabi -fsanitize=undefined %s -### 2>&1 | FileCheck %s -check-prefix=UNDEFINED-BAREMETAL |
| 29 |
// RUN: %clang --target=aarch64-none-elf -fsanitize=undefined %s -### 2>&1 | FileCheck %s -check-prefix=UNDEFINED-BAREMETAL |
| 30 |
// UNDEFINED-BAREMETAL: "-fsanitize={{.*}} |
| 31 |
|
| 32 |
// RUN: %clang --target=arm-arm-none-eabi -fsanitize=scudo %s -### 2>&1 | FileCheck %s -check-prefix=SCUDO-BAREMETAL |
| 33 |
// RUN: %clang --target=aarch64-none-elf -fsanitize=scudo %s -### 2>&1 | FileCheck %s -check-prefix=SCUDO-BAREMETAL |
| 34 |
// SCUDO-BAREMETAL: "-fsanitize=scudo" |
| 35 |
|
| 36 |
// RUN: %clang --target=arm-arm-none-eabi -fsanitize=function %s -### 2>&1 | FileCheck %s -check-prefix=FUNCTION-BAREMETAL |
| 37 |
// RUN: %clang --target=aarch64-none-elf -fsanitize=function %s -### 2>&1 | FileCheck %s -check-prefix=FUNCTION-BAREMETAL |
| 38 |
// FUNCTION-BAREMETAL: "-fsanitize=function" |
| 39 |
|
| 40 |
// RUN: not %clang --target=aarch64-none-elf -fsanitize=memory %s -### 2>&1 | FileCheck %s -check-prefix=UNSUPPORTED-BAREMETAL |
| 41 |
// RUN: not %clang --target=aarch64-none-elf -fsanitize=kernel-memory %s -### 2>&1 | FileCheck %s -check-prefix=UNSUPPORTED-BAREMETAL |
| 42 |
// RUN: not %clang --target=aarch64-none-elf -fsanitize=leak %s -### 2>&1 | FileCheck %s -check-prefix=UNSUPPORTED-BAREMETAL |
| 43 |
// RUN: not %clang --target=aarch64-none-elf -fsanitize=dataflow %s -### 2>&1 | FileCheck %s -check-prefix=UNSUPPORTED-BAREMETAL |
| 44 |
// RUN: not %clang --target=arm-arm-none-eabi -fsanitize=shadow-call-stack %s -### 2>&1 | FileCheck %s -check-prefix=UNSUPPORTED-BAREMETAL |
| 45 |
// UNSUPPORTED-BAREMETAL: unsupported option '-fsanitize={{.*}}' for target |