diff options
author | Mike Aizatsky <aizatsky@chromium.org> | 2017-02-08 23:12:46 +0000 |
---|---|---|
committer | Mike Aizatsky <aizatsky@chromium.org> | 2017-02-08 23:12:46 +0000 |
commit | 4705ae936d8bee98501227f81fbe48bbd5ff03bf (patch) | |
tree | 30cdb83a84e19bf35ccd335824002bcbfd6efcc3 /llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp | |
parent | db7bbcbe784e78a194091b53c49edd7fca3a74eb (diff) | |
download | bcm5719-llvm-4705ae936d8bee98501227f81fbe48bbd5ff03bf.tar.gz bcm5719-llvm-4705ae936d8bee98501227f81fbe48bbd5ff03bf.zip |
[sancov] using comdat only when it is enabled
Differential Revision: https://reviews.llvm.org/D29733
llvm-svn: 294529
Diffstat (limited to 'llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp')
-rw-r--r-- | llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp b/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp index 76e5f8bd660..8f7ac9c971e 100644 --- a/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp +++ b/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp @@ -382,9 +382,13 @@ bool SanitizerCoverageModule::runOnModule(Module &M) { {IRB.CreatePointerCast(SecStart, Int32PtrTy), IRB.CreatePointerCast(SecEnd, Int32PtrTy)}); - // Use comdat to dedup CtorFunc. - CtorFunc->setComdat(M.getOrInsertComdat(SanCovModuleCtorName)); - appendToGlobalCtors(M, CtorFunc, SanCtorAndDtorPriority, CtorFunc); + if (TargetTriple.supportsCOMDAT()) { + // Use comdat to dedup CtorFunc. + CtorFunc->setComdat(M.getOrInsertComdat(SanCovModuleCtorName)); + appendToGlobalCtors(M, CtorFunc, SanCtorAndDtorPriority, CtorFunc); + } else { + appendToGlobalCtors(M, CtorFunc, SanCtorAndDtorPriority); + } } } else if (!Options.TracePC) { Function *CtorFunc; |