brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · 4c8a86e Raw
31 lines · cpp
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 %s6 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 %s10 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 %s14 15extern "C" int HasSanitizeMemTag() { return 1; }16// CHECK-NO: Function Attrs17// CHECK-NO-NOT: sanitize_memtag18// CHECK-NO-NEXT: define {{.*}} @HasSanitizeMemTag(19// CHECK-MEMTAG: Function Attrs: {{.*}} sanitize_memtag20// CHECK-MEMTAG-NEXT: define {{.*}} @HasSanitizeMemTag(21 22extern "C" __attribute__((no_sanitize("memtag"))) int NoSanitizeQuoteAddress() {23  return 0;24}25// CHECK-NO: Function Attrs26// CHECK-NO-NOT: sanitize_memtag27// CHECK-NO-NEXT: define {{.*}} @NoSanitizeQuoteAddress(28// CHECK-MEMTAG: Function Attrs29// CHECK-MEMTAG-NOT: sanitize_memtag30// CHECK-MEMTAG-NEXT: define {{.*}} @NoSanitizeQuoteAddress(31