summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2016-09-20 00:16:54 +0000
committerKostya Serebryany <kcc@google.com>2016-09-20 00:16:54 +0000
commit06694d0a2f487c5fc59dd8e2d76366d97598abfb (patch)
treeedd557e55190338c047e169f6eeb5d746615474f /llvm/lib
parentd1d7cfcd520ec67f6ce0dd284980c040d98b9fbb (diff)
downloadbcm5719-llvm-06694d0a2f487c5fc59dd8e2d76366d97598abfb.tar.gz
bcm5719-llvm-06694d0a2f487c5fc59dd8e2d76366d97598abfb.zip
[sanitizer-coverage] add comdat to coverage guards if needed
llvm-svn: 281952
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp b/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
index a2755adc7fa..9e1ff1cd6d2 100644
--- a/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
+++ b/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
@@ -669,6 +669,8 @@ void SanitizerCoverageModule::InjectCoverageAtBlock(Function &F, BasicBlock &BB,
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);
OpenPOWER on IntegriCloud