xref: /llvm-project/compiler-rt/test/hwasan/TestCases/build-ids.c (revision edd2b99a57c127dc3d99fe7550d69a113de53eb0)
1 // RUN: %clang_hwasan -Wl,--build-id=0xaba493998257fbdd %s -o %t
2 // RUN: %env_hwasan_opts=symbolize=0 not %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK,NOSYM
3 // RUN: not %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK,SYM
4 
5 #include <stdlib.h>
6 
7 #include <sanitizer/hwasan_interface.h>
8 
main(int argc,char ** argv)9 int main(int argc, char **argv) {
10   __hwasan_enable_allocator_tagging();
11   char *buf = (char *)malloc(1);
12   buf[32] = 'x';
13   // CHECK: ERROR: HWAddressSanitizer: tag-mismatch
14   // NOSYM:  0x{{.*}}  {{.*}}build-ids.c{{.*}} (BuildId: aba493998257fbdd)
15   // SYM:  0x{{.*}} in main {{.*}}build-ids.c:[[@LINE-3]]:{{[0-9]+}}
16   return 0;
17 }
18