diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2016-03-24 14:58:44 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2016-03-24 14:58:44 +0000 |
commit | 42e032376898ce867355515a2af51748bc9d7668 (patch) | |
tree | bfc74b6797c1301cc2e3d94d4c6243eb9bd186d2 /llvm/lib/Linker | |
parent | 15f8fb6f83c01606acecaad4c8a3341c29e712e0 (diff) | |
download | bcm5719-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.cpp | 10 |
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()) { |