aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
diff options
context:
space:
mode:
authorXinliang David Li <davidxl@google.com>2016-05-24 18:47:38 +0000
committerXinliang David Li <davidxl@google.com>2016-05-24 18:47:38 +0000
commitf4edae6076d9c09f2c759b0b26bddf6e2eab8b13 (patch)
tree9962d076443257e7210bac8bfd32ce9df328595b /llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
parent141149ff4865e024a0f971f3138f226896fdeddf (diff)
downloadllvm-f4edae6076d9c09f2c759b0b26bddf6e2eab8b13.zip
llvm-f4edae6076d9c09f2c759b0b26bddf6e2eab8b13.tar.gz
llvm-f4edae6076d9c09f2c759b0b26bddf6e2eab8b13.tar.bz2
[profile] Fix runtime hook linkage bug for COFF
Patch by: Johan Engelen the user hook has linkonceODR linkage and it needs to be in comdatAny group. llvm-svn: 270596
Diffstat (limited to 'llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp')
-rw-r--r--llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp b/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
index 97e8bd1..120ed18 100644
--- a/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
+++ b/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
@@ -550,6 +550,8 @@ void InstrProfiling::emitRuntimeHook() {
User->addFnAttr(Attribute::NoInline);
if (Options.NoRedZone) User->addFnAttr(Attribute::NoRedZone);
User->setVisibility(GlobalValue::HiddenVisibility);
+ if (Triple(M->getTargetTriple()).isOSBinFormatCOFF())
+ User->setComdat(M->getOrInsertComdat(User->getName()));
IRBuilder<> IRB(BasicBlock::Create(M->getContext(), "", User));
auto *Load = IRB.CreateLoad(Var);