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
9int main(int argc, char **argv) {
10 __hwasan_enable_allocator_tagging();
11 char *buf = (char *)malloc(size: 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

source code of compiler-rt/test/hwasan/TestCases/build-ids.c