1 // REQUIRES: aarch64-registered-target
2 
3 // RUN: %clang_cc1 -include %S/Inputs/sanitizer-extra-source.cpp \
4 // RUN:   -fsanitize-ignorelist=%S/Inputs/sanitizer-ignorelist-global.txt \
5 // RUN:   -fsanitize=hwaddress -emit-llvm -triple aarch64-linux-android31 -o -\
6 // RUN:    %s | FileCheck %s
7 
8 // RUN: %clang_cc1 -include %S/Inputs/sanitizer-extra-source.cpp \
9 // RUN:   -fsanitize-ignorelist=%S/Inputs/sanitizer-ignorelist-src.txt \
10 // RUN:   -fsanitize=hwaddress -emit-llvm -triple aarch64-linux-android31 -o -\
11 // RUN:   %s | FileCheck %s --check-prefix=IGNORELIST
12 
13 int global;
14 int __attribute__((no_sanitize("hwaddress"))) attributed_global;
15 int __attribute__((disable_sanitizer_instrumentation)) disable_instrumentation_global;
16 int ignorelisted_global;
17 
18 void func() {
19   static int static_var = 0;
20   const char *literal = "Hello, world!";
21 }
22 
23 // CHECK: @{{.*}}attributed_global{{.*}} ={{.*}} global {{.*}}, no_sanitize_hwaddress
24 // CHECK: @{{.*}}disable_instrumentation_global{{.*}} ={{.*}} global {{.*}}, no_sanitize_hwaddress
25 // CHECK: @{{.*}}ignorelisted_global{{.*}} ={{.*}} global {{.*}}, no_sanitize_hwaddress
26 // CHECK: @{{.*}}extra_global{{.*}}.hwasan{{.*}} =
27 // CHECK: @{{.*}}global{{.*}}.hwasan{{.*}} =
28 // CHECK: @{{.*}}static_var{{.*}}.hwasan{{.*}} =
29 // CHECK: @{{.*}}.hwasan{{.*}} = {{.*}} c"Hello, world!\00"
30 
31 // IGNORELIST: @{{.*}}global{{.*}} ={{.*}} global {{.*}}, no_sanitize_hwaddress
32 // IGNORELIST: @{{.*}}attributed_global{{.*}} ={{.*}} global {{.*}}, no_sanitize_hwaddress
33 // IGNORELIST: @{{.*}}disable_instrumentation_global{{.*}} ={{.*}} global {{.*}}, no_sanitize_hwaddress
34 // IGNORELIST: @{{.*}}ignorelisted_globa{{.*}} ={{.*}} global {{.*}}, no_sanitize_hwaddress
35 // IGNORELIST: @{{.*}}static_var{{.*}} ={{.*}} global {{.*}}, no_sanitize_hwaddress
36 // IGNORELIST: @{{.*}} = {{.*}} c"Hello, world!\00"{{.*}}, no_sanitize_hwaddress
37 // IGNORELIST: @{{.*}}extra_global{{.*}}.hwasan{{.*}} =
38