summaryrefslogtreecommitdiff
path: root/lib
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
commit0f324db0db5d57cebe1b16701b8a6f4e1fc77562 (patch)
treed4c3a76fde0a53de0db84ee339f9fd83f6eda80f /lib
parent82332cd02ef0ae375797d96f4f2646c36d8979ed (diff)
[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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270596 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Transforms/Instrumentation/InstrProfiling.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/Transforms/Instrumentation/InstrProfiling.cpp b/lib/Transforms/Instrumentation/InstrProfiling.cpp
index 97e8bd1ae11..120ed18b06e 100644
--- a/lib/Transforms/Instrumentation/InstrProfiling.cpp
+++ b/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);