1 // Tests trace pc guard coverage collection.
3 // REQUIRES: has_sancovcc,stable-runtime,x86_64-linux
6 // RUN: CLANG_ARGS="-O0 -fsanitize-coverage=trace-pc-guard"
10 // RUN: %clangxx -DSHARED1 $CLANG_ARGS -shared %s -o %t_1.so -fPIC
11 // RUN: %clangxx -DSTATIC1 $CLANG_ARGS %s -c -o %t_2.o
12 // RUN: %clangxx -DMAIN $CLANG_ARGS %s -o %t %t_1.so %t_2.o
13 // RUN: %env_tool_opts=coverage=1 %t 2>&1 | FileCheck %s
27 extern "C" void __sanitizer_cov_trace_pc_guard_init(uint32_t *start
, uint32_t *stop
) {
28 fprintf(stderr
, "__sanitizer_cov_trace_pc_guard_init\n");
31 extern "C" void __sanitizer_cov_trace_pc_guard(uint32_t *guard
) { }
35 fprintf(stderr
, "foo\n");
40 fprintf(stderr
, "main\n");
52 fprintf(stderr
, "bar\n");
59 fprintf(stderr
, "baz\n");
66 // Init is called once per DSO.
67 // CHECK: __sanitizer_cov_trace_pc_guard_init
68 // CHECK-NEXT: __sanitizer_cov_trace_pc_guard_init