| 1 |
// Make sure the sanitize_memtag attribute is emitted when using MemTag sanitizer. |
| 2 |
// Make sure __attribute__((no_sanitize("memtag")) disables instrumentation. |
| 3 |
|
| 4 |
// RUN: %clang_cc1 -triple aarch64-unknown-linux -disable-O0-optnone \ |
| 5 |
// RUN: -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-NO %s |
| 6 |
|
| 7 |
// RUN: %clang_cc1 -triple aarch64-unknown-linux -fsanitize=memtag-stack \ |
| 8 |
// RUN: -disable-O0-optnone -emit-llvm -o - %s | \ |
| 9 |
// RUN: FileCheck -check-prefix=CHECK-MEMTAG %s |
| 10 |
|
| 11 |
// RUN: %clang --target=aarch64-unknown-linux -march=armv8a+memtag \ |
| 12 |
// RUN: -fsanitize=memtag -disable-O0-optnone -S -emit-llvm -o - %s | \ |
| 13 |
// RUN: FileCheck -check-prefix=CHECK-MEMTAG %s |
| 14 |
|
| 15 |
extern "C" int HasSanitizeMemTag() { return 1; } |
| 16 |
// CHECK-NO: Function Attrs |
| 17 |
// CHECK-NO-NOT: sanitize_memtag |
| 18 |
// CHECK-NO-NEXT: define {{.*}} @HasSanitizeMemTag( |
| 19 |
// CHECK-MEMTAG: Function Attrs: {{.*}} sanitize_memtag |
| 20 |
// CHECK-MEMTAG-NEXT: define {{.*}} @HasSanitizeMemTag( |
| 21 |
|
| 22 |
extern "C" __attribute__((no_sanitize("memtag"))) int NoSanitizeQuoteAddress() { |
| 23 |
return 0; |
| 24 |
} |
| 25 |
// CHECK-NO: Function Attrs |
| 26 |
// CHECK-NO-NOT: sanitize_memtag |
| 27 |
// CHECK-NO-NEXT: define {{.*}} @NoSanitizeQuoteAddress( |
| 28 |
// CHECK-MEMTAG: Function Attrs |
| 29 |
// CHECK-MEMTAG-NOT: sanitize_memtag |
| 30 |
// CHECK-MEMTAG-NEXT: define {{.*}} @NoSanitizeQuoteAddress( |