forked from OSchip/llvm-project
[sanitizer-coverage] make sure asan does not instrument coverage guards (reported in https://github.com/google/oss-fuzz/issues/84)
llvm-svn: 287030
This commit is contained in:
parent
cf8d1fc3d8
commit
9d6dc7b164
|
@ -514,7 +514,7 @@ void SanitizerCoverageModule::CreateFunctionGuardArray(size_t NumGuards,
|
|||
ArrayType *ArrayOfInt32Ty = ArrayType::get(Int32Ty, NumGuards);
|
||||
FunctionGuardArray = new GlobalVariable(
|
||||
*CurModule, ArrayOfInt32Ty, false, GlobalVariable::PrivateLinkage,
|
||||
Constant::getNullValue(ArrayOfInt32Ty), "__sancov_guard");
|
||||
Constant::getNullValue(ArrayOfInt32Ty), "__sancov_gen_");
|
||||
if (auto Comdat = F.getComdat())
|
||||
FunctionGuardArray->setComdat(Comdat);
|
||||
FunctionGuardArray->setSection(SanCovTracePCGuardSection);
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
; Test that the coverage guards have proper comdat
|
||||
; RUN: opt < %s -sancov -sanitizer-coverage-level=3 -sanitizer-coverage-trace-pc-guard -S | FileCheck %s
|
||||
; RUN: opt < %s -sancov -sanitizer-coverage-level=3 -sanitizer-coverage-trace-pc-guard -S | FileCheck %s
|
||||
; Make sure asan does not instrument __sancov_gen_
|
||||
; RUN: opt < %s -sancov -asan -asan-module -sanitizer-coverage-level=3 -sanitizer-coverage-trace-pc-guard -S | FileCheck %s
|
||||
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
||||
target triple = "x86_64-unknown-linux-gnu"
|
||||
$Foo = comdat any
|
||||
|
@ -9,4 +11,10 @@ entry:
|
|||
ret void
|
||||
}
|
||||
|
||||
; CHECK: @__sancov_guard = private global [1 x i32] zeroinitializer, section "__sancov_guards", comdat($Foo)
|
||||
define linkonce_odr void @Bar() {
|
||||
entry:
|
||||
ret void
|
||||
}
|
||||
|
||||
; CHECK: @__sancov_gen_ = private global [1 x i32] zeroinitializer, section "__sancov_guards", comdat($Foo)
|
||||
; CHECK: @__sancov_gen_.1 = private global [1 x i32] zeroinitializer, section "__sancov_guards"
|
||||
|
|
Loading…
Reference in New Issue