1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00

[sanitizer-coverage] use private linkage for coverage guards, delete old commented-out code.

llvm-svn: 283924
This commit is contained in:
Kostya Serebryany 2016-10-11 19:36:50 +00:00
parent 7d7380c0c5
commit cb7566ce29
2 changed files with 5 additions and 13 deletions

View File

@ -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)),

View File

@ -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)