summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Linker
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2016-03-24 14:58:44 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2016-03-24 14:58:44 +0000
commit42e032376898ce867355515a2af51748bc9d7668 (patch)
treebfc74b6797c1301cc2e3d94d4c6243eb9bd186d2 /llvm/lib/Linker
parent15f8fb6f83c01606acecaad4c8a3341c29e712e0 (diff)
downloadbcm5719-llvm-42e032376898ce867355515a2af51748bc9d7668.tar.gz
bcm5719-llvm-42e032376898ce867355515a2af51748bc9d7668.zip
Fix resolution of linkonce symbols in comdats.
After comdat processing, the symbols still go through regular symbol resolution. We were not doing it for linkonce symbols since they are lazy linked. This fixes pr27044. llvm-svn: 264288
Diffstat (limited to 'llvm/lib/Linker')
-rw-r--r--llvm/lib/Linker/LinkModules.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/llvm/lib/Linker/LinkModules.cpp b/llvm/lib/Linker/LinkModules.cpp
index 9ee3fb32e21..f6e0f060cc0 100644
--- a/llvm/lib/Linker/LinkModules.cpp
+++ b/llvm/lib/Linker/LinkModules.cpp
@@ -566,8 +566,14 @@ bool ModuleLinker::run() {
const Comdat *SC = GV->getComdat();
if (!SC)
continue;
- for (GlobalValue *GV2 : LazyComdatMembers[SC])
- ValuesToLink.insert(GV2);
+ for (GlobalValue *GV2 : LazyComdatMembers[SC]) {
+ GlobalValue *DGV = getLinkedToGlobal(GV2);
+ bool LinkFromSrc = true;
+ if (DGV && shouldLinkFromSource(LinkFromSrc, *DGV, *GV2))
+ return true;
+ if (LinkFromSrc)
+ ValuesToLink.insert(GV2);
+ }
}
if (shouldInternalizeLinkedSymbols()) {
OpenPOWER on IntegriCloud