llvm.org GIT mirror llvm / dd850be
[sanitizer-coverage] make sure asan does not instrument coverage guards (reported in https://github.com/google/oss-fuzz/issues/84) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287030 91177308-0d34-0410-b5e6-96231b3b80d8 Kostya Serebryany 4 years ago
2 changed file(s) with 11 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
513513 ArrayType *ArrayOfInt32Ty = ArrayType::get(Int32Ty, NumGuards);
514514 FunctionGuardArray = new GlobalVariable(
515515 *CurModule, ArrayOfInt32Ty, false, GlobalVariable::PrivateLinkage,
516 Constant::getNullValue(ArrayOfInt32Ty), "__sancov_guard");
516 Constant::getNullValue(ArrayOfInt32Ty), "__sancov_gen_");
517517 if (auto Comdat = F.getComdat())
518518 FunctionGuardArray->setComdat(Comdat);
519519 FunctionGuardArray->setSection(SanCovTracePCGuardSection);
0 ; Test that the coverage guards have proper comdat
1 ; RUN: opt < %s -sancov -sanitizer-coverage-level=3 -sanitizer-coverage-trace-pc-guard -S | FileCheck %s
1 ; RUN: opt < %s -sancov -sanitizer-coverage-level=3 -sanitizer-coverage-trace-pc-guard -S | FileCheck %s
2 ; Make sure asan does not instrument __sancov_gen_
3 ; RUN: opt < %s -sancov -asan -asan-module -sanitizer-coverage-level=3 -sanitizer-coverage-trace-pc-guard -S | FileCheck %s
24 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
35 target triple = "x86_64-unknown-linux-gnu"
46 $Foo = comdat any
810 ret void
911 }
1012
11 ; CHECK: @__sancov_guard = private global [1 x i32] zeroinitializer, section "__sancov_guards", comdat($Foo)
13 define linkonce_odr void @Bar() {
14 entry:
15 ret void
16 }
17
18 ; CHECK: @__sancov_gen_ = private global [1 x i32] zeroinitializer, section "__sancov_guards", comdat($Foo)
19 ; CHECK: @__sancov_gen_.1 = private global [1 x i32] zeroinitializer, section "__sancov_guards"