1 // Tests trace pc guard coverage collection.
3 // REQUIRES: has_sancovcc,stable-runtime,x86_64-linux
5 // RUN: rm -rf %t_workdir
6 // RUN: mkdir -p %t_workdir
8 // RUN: %clangxx -DSHARED1 -O0 -fsanitize-coverage=trace-pc-guard -shared %s -o %t_1.so -fPIC
9 // RUN: %clangxx -DSTATIC1 -O0 -fsanitize-coverage=trace-pc-guard %s -c -o %t_2.o
10 // RUN: %clangxx -DMAIN -O0 -fsanitize-coverage=trace-pc-guard %s -o %t %t_1.so %t_2.o
11 // RUN: %env_tool_opts=coverage=1 %t 2>&1 | FileCheck %s
12 // RUN: rm -rf %t_workdir
25 extern "C" void __sanitizer_cov_trace_pc_guard_init(uint32_t *start
, uint32_t *stop
) {
26 fprintf(stderr
, "__sanitizer_cov_trace_pc_guard_init\n");
29 extern "C" void __sanitizer_cov_trace_pc_guard(uint32_t *guard
) { }
33 fprintf(stderr
, "foo\n");
38 fprintf(stderr
, "main\n");
50 fprintf(stderr
, "bar\n");
57 fprintf(stderr
, "baz\n");
64 // Init is called once per DSO.
65 // CHECK: __sanitizer_cov_trace_pc_guard_init
66 // CHECK-NEXT: __sanitizer_cov_trace_pc_guard_init