summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Linker/LinkModules.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2016-03-24 15:23:01 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2016-03-24 15:23:01 +0000
commite1c42ac12b29462944af83719c92fa5546da6a90 (patch)
tree43fe4b6e0f2aed900155d04dc6e03804d87f52aa /llvm/lib/Linker/LinkModules.cpp
parentd8c1be66abc7ba4997656b5c3f87a94839cbc617 (diff)
downloadbcm5719-llvm-e1c42ac12b29462944af83719c92fa5546da6a90.tar.gz
bcm5719-llvm-e1c42ac12b29462944af83719c92fa5546da6a90.zip
Fix another case where we were unconditionally linking linkonce GVs.
With this I think that now llvm-link, lld and the gold plugin should agree on which symbol is kept. llvm-svn: 264292
Diffstat (limited to 'llvm/lib/Linker/LinkModules.cpp')
-rw-r--r--llvm/lib/Linker/LinkModules.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Linker/LinkModules.cpp b/llvm/lib/Linker/LinkModules.cpp
index f6e0f060cc0..c07c47ef687 100644
--- a/llvm/lib/Linker/LinkModules.cpp
+++ b/llvm/lib/Linker/LinkModules.cpp
@@ -447,6 +447,12 @@ void ModuleLinker::addLazyFor(GlobalValue &GV, IRMover::ValueAdder Add) {
if (!SC)
return;
for (GlobalValue *GV2 : LazyComdatMembers[SC]) {
+ GlobalValue *DGV = getLinkedToGlobal(GV2);
+ bool LinkFromSrc = true;
+ if (DGV && shouldLinkFromSource(LinkFromSrc, *DGV, *GV2))
+ return;
+ if (!LinkFromSrc)
+ continue;
if (shouldInternalizeLinkedSymbols())
Internalize.insert(GV2->getName());
Add(*GV2);
OpenPOWER on IntegriCloud