llvm.org GIT mirror llvm / be07cfb
[sanitizer-coverage] rename sanitizer-coverage-create-pc-table into sanitizer-coverage-pc-table and add plumbing for a clang flag git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309337 91177308-0d34-0410-b5e6-96231b3b80d8 Kostya Serebryany 2 years ago
3 changed file(s) with 9 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
182182 bool TracePC = false;
183183 bool TracePCGuard = false;
184184 bool Inline8bitCounters = false;
185 bool PCTable = false;
185186 bool NoPrune = false;
186187
187188 SanitizerCoverageOptions() = default;
8383 // to __sanitizer_cov_pcs_init.
8484 // This way the coverage instrumentation does not need to acquire the PCs
8585 // at run-time. Works with trace-pc-guard and inline-8bit-counters.
86 static cl::opt ClCreatePCTable("sanitizer-coverage-create-pc-table",
86 static cl::opt ClCreatePCTable("sanitizer-coverage-pc-table",
8787 cl::desc("create a static PC table"),
8888 cl::Hidden, cl::init(false));
8989
146146 Options.TracePC |= ClTracePC;
147147 Options.TracePCGuard |= ClTracePCGuard;
148148 Options.Inline8bitCounters |= ClInline8bitCounters;
149 Options.PCTable |= ClCreatePCTable;
149150 if (!Options.TracePCGuard && !Options.TracePC && !Options.Inline8bitCounters)
150151 Options.TracePCGuard = true; // TracePCGuard is default.
151152 Options.NoPrune |= !ClPruneBlocks;
215216
216217 GlobalVariable *FunctionGuardArray; // for trace-pc-guard.
217218 GlobalVariable *Function8bitCounterArray; // for inline-8bit-counters.
218 GlobalVariable *FunctionPCsArray; // for create-pc-table.
219 GlobalVariable *FunctionPCsArray; // for pc-table.
219220
220221 SanitizerCoverageOptions Options;
221222 };
340341 if (Function8bitCounterArray)
341342 Ctor = CreateInitCallsForSections(M, SanCov8bitCountersInitName, Int8PtrTy,
342343 SanCovCountersSectionName);
343 if (Ctor && ClCreatePCTable) {
344 if (Ctor && Options.PCTable) {
344345 auto SecStartEnd = CreateSecStartEnd(M, SanCovPCsSectionName, Int8PtrTy);
345346 Function *InitFunction = declareSanitizerInitFunction(
346347 M, SanCovPCsInitName, {Int8PtrTy, Int8PtrTy});
514515 if (Options.Inline8bitCounters)
515516 Function8bitCounterArray = CreateFunctionLocalArrayInSection(
516517 AllBlocks.size(), F, Int8Ty, SanCovCountersSectionName);
517 if (ClCreatePCTable)
518 if (Options.PCTable)
518519 CreatePCArray(F, AllBlocks);
519520 }
520521
None ; Test -sanitizer-coverage-create-pc-table=1
1 ; RUN: opt < %s -sancov -sanitizer-coverage-level=3 -sanitizer-coverage-trace-pc-guard -sanitizer-coverage-create-pc-table=1 -S | FileCheck %s
2 ; RUN: opt < %s -sancov -sanitizer-coverage-level=3 -sanitizer-coverage-inline-8bit-counters -sanitizer-coverage-create-pc-table=1 -S | FileCheck %s
0 ; Test -sanitizer-coverage-pc-table=1
1 ; RUN: opt < %s -sancov -sanitizer-coverage-level=3 -sanitizer-coverage-trace-pc-guard -sanitizer-coverage-pc-table=1 -S | FileCheck %s
2 ; RUN: opt < %s -sancov -sanitizer-coverage-level=3 -sanitizer-coverage-inline-8bit-counters -sanitizer-coverage-pc-table=1 -S | FileCheck %s
33
44 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
55 target triple = "x86_64-unknown-linux-gnu"