llvm.org GIT mirror llvm / 884f3fe
[sancov] specifying comdat for sancov constructors Differential Revision: https://reviews.llvm.org/D29662 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294517 91177308-0d34-0410-b5e6-96231b3b80d8 Mike Aizatsky 2 years ago
2 changed file(s) with 16 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
381381 {IRB.CreatePointerCast(SecStart, Int32PtrTy),
382382 IRB.CreatePointerCast(SecEnd, Int32PtrTy)});
383383
384 appendToGlobalCtors(M, CtorFunc, SanCtorAndDtorPriority);
384 // Use comdat to dedup CtorFunc.
385 CtorFunc->setComdat(M.getOrInsertComdat(SanCovModuleCtorName));
386 appendToGlobalCtors(M, CtorFunc, SanCtorAndDtorPriority, CtorFunc);
385387 }
386388 } else if (!Options.TracePC) {
387389 Function *CtorFunc;
66 ; RUN: opt < %s -sancov -sanitizer-coverage-level=3 -sanitizer-coverage-block-threshold=10 -S | FileCheck %s --check-prefix=CHECK3
77 ; RUN: opt < %s -sancov -sanitizer-coverage-level=4 -S | FileCheck %s --check-prefix=CHECK4
88 ; RUN: opt < %s -sancov -sanitizer-coverage-level=4 -sanitizer-coverage-trace-pc -S | FileCheck %s --check-prefix=CHECK_TRACE_PC
9 ; RUN: opt < %s -sancov -sanitizer-coverage-level=4 -sanitizer-coverage-trace-pc-guard -S | FileCheck %s --check-prefix=CHECK_TRACE_PC
9 ; RUN: opt < %s -sancov -sanitizer-coverage-level=4 -sanitizer-coverage-trace-pc-guard -S | FileCheck %s --check-prefix=CHECK_TRACE_PC_GUARD
1010 ; RUN: opt < %s -sancov -sanitizer-coverage-level=3 -sanitizer-coverage-8bit-counters=1 -S | FileCheck %s --check-prefix=CHECK-8BIT
1111
1212 ; RUN: opt < %s -sancov -sanitizer-coverage-level=2 -sanitizer-coverage-block-threshold=10 \
130130 ; CHECK_TRACE_PC: call void @__sanitizer_cov_trace_pc_indir
131131 ; CHECK_TRACE_PC: ret void
132132
133 ; CHECK_TRACE_PC_GUARD-LABEL: define void @foo
134 ; CHECK_TRACE_PC_GUARD: call void @__sanitizer_cov_trace_pc
135 ; CHECK_TRACE_PC_GUARD: call void asm sideeffect "", ""()
136 ; CHECK_TRACE_PC_GUARD: ret void
137
138 ; CHECK_TRACE_PC_GUARD-LABEL: define void @CallViaVptr
139 ; CHECK_TRACE_PC_GUARD: call void @__sanitizer_cov_trace_pc_indir
140 ; CHECK_TRACE_PC_GUARD: call void @__sanitizer_cov_trace_pc_indir
141 ; CHECK_TRACE_PC_GUARD: ret void
142
143 ; CHECK_TRACE_PC_GUARD-LABEL: define internal void @sancov.module_ctor() comdat
144
133145 define void @call_unreachable() uwtable sanitize_address {
134146 entry:
135147 unreachable