diff options
| author | Kostya Serebryany <kcc@google.com> | 2016-10-11 19:36:50 +0000 |
|---|---|---|
| committer | Kostya Serebryany <kcc@google.com> | 2016-10-11 19:36:50 +0000 |
| commit | 4d25ad93f3f52ca8976b4a09959135ec42d6da03 (patch) | |
| tree | ef91453bc15993e7e6656f2ba3d7315181db9b6d /llvm | |
| parent | e8be3ad9b2b4c95beccdfd213a53356a7ebd12af (diff) | |
| download | bcm5719-llvm-4d25ad93f3f52ca8976b4a09959135ec42d6da03.tar.gz bcm5719-llvm-4d25ad93f3f52ca8976b4a09959135ec42d6da03.zip | |
[sanitizer-coverage] use private linkage for coverage guards, delete old commented-out code.
llvm-svn: 283924
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp | 16 | ||||
| -rw-r--r-- | llvm/test/Instrumentation/SanitizerCoverage/tracing-comdat.ll | 2 |
2 files changed, 5 insertions, 13 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp b/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp index 89106f67d6f..93ca8668eaf 100644 --- a/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp +++ b/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp @@ -502,17 +502,17 @@ bool SanitizerCoverageModule::runOnFunction(Function &F) { InjectTraceForGep(F, GepTraceTargets); return true; } -void SanitizerCoverageModule::CreateFunctionGuardArray(size_t NumGuards, Function &F) { +void SanitizerCoverageModule::CreateFunctionGuardArray(size_t NumGuards, + Function &F) { if (!Options.TracePCGuard) return; HasSancovGuardsSection = true; ArrayType *ArrayOfInt32Ty = ArrayType::get(Int32Ty, NumGuards); FunctionGuardArray = new GlobalVariable( - *CurModule, ArrayOfInt32Ty, false, GlobalVariable::LinkOnceODRLinkage, - Constant::getNullValue(ArrayOfInt32Ty), "__sancov_guard." + F.getName()); + *CurModule, ArrayOfInt32Ty, false, GlobalVariable::PrivateLinkage, + Constant::getNullValue(ArrayOfInt32Ty), "__sancov_guard"); if (auto Comdat = F.getComdat()) FunctionGuardArray->setComdat(Comdat); FunctionGuardArray->setSection(SanCovTracePCGuardSection); - FunctionGuardArray->setVisibility(GlobalValue::HiddenVisibility); } bool SanitizerCoverageModule::InjectCoverage(Function &F, @@ -687,14 +687,6 @@ void SanitizerCoverageModule::InjectCoverageAtBlock(Function &F, BasicBlock &BB, IRB.CreateCall(SanCovTracePC); // gets the PC using GET_CALLER_PC. IRB.CreateCall(EmptyAsm, {}); // Avoids callback merge. } else if (Options.TracePCGuard) { - //auto GuardVar = new GlobalVariable( - // *F.getParent(), Int64Ty, false, GlobalVariable::LinkOnceODRLinkage, - // Constant::getNullValue(Int64Ty), "__sancov_guard." + F.getName()); - // if (auto Comdat = F.getComdat()) - // GuardVar->setComdat(Comdat); - // TODO: add debug into to GuardVar. - // GuardVar->setSection(SanCovTracePCGuardSection); - // auto GuardPtr = IRB.CreatePointerCast(GuardVar, IntptrPtrTy); auto GuardPtr = IRB.CreateIntToPtr( IRB.CreateAdd(IRB.CreatePointerCast(FunctionGuardArray, IntptrTy), ConstantInt::get(IntptrTy, Idx * 4)), diff --git a/llvm/test/Instrumentation/SanitizerCoverage/tracing-comdat.ll b/llvm/test/Instrumentation/SanitizerCoverage/tracing-comdat.ll index 9dc1a995f2a..f5fa326f8fa 100644 --- a/llvm/test/Instrumentation/SanitizerCoverage/tracing-comdat.ll +++ b/llvm/test/Instrumentation/SanitizerCoverage/tracing-comdat.ll @@ -9,4 +9,4 @@ entry: ret void } -; CHECK: @__sancov_guard.Foo = linkonce_odr hidden global [1 x i32] zeroinitializer, section "__sancov_guards", comdat($Foo) +; CHECK: @__sancov_guard = private global [1 x i32] zeroinitializer, section "__sancov_guards", comdat($Foo) |

