summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Linker/LinkModules.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2016-03-23 21:16:33 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2016-03-23 21:16:33 +0000
commitf2e71244c6274984c33df9a58a78fcf71218ee21 (patch)
treea2dbe36cac4b3a6134c50acd38d58a629d4153c3 /llvm/lib/Linker/LinkModules.cpp
parent3c0bc9697a97cb4d1e50423b28419eb3fa80b7de (diff)
downloadbcm5719-llvm-f2e71244c6274984c33df9a58a78fcf71218ee21.tar.gz
bcm5719-llvm-f2e71244c6274984c33df9a58a78fcf71218ee21.zip
Fix logic for which symbols to keep with comdats.
If a comdat is dropped, all symbols in it are dropped. If a comdat is kept, the symbols survive to pass regular symbol resolution. With this patch we do that for all global symbols. The added test is a copy of test/tools/gold/X86/comdat.ll that we now pass. llvm-svn: 264192
Diffstat (limited to 'llvm/lib/Linker/LinkModules.cpp')
-rw-r--r--llvm/lib/Linker/LinkModules.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/Linker/LinkModules.cpp b/llvm/lib/Linker/LinkModules.cpp
index 8eeccb369df..d3c3ea34e6d 100644
--- a/llvm/lib/Linker/LinkModules.cpp
+++ b/llvm/lib/Linker/LinkModules.cpp
@@ -422,9 +422,8 @@ bool ModuleLinker::linkIfNeeded(GlobalValue &GV) {
bool LinkFromSrc;
Comdat::SelectionKind SK;
std::tie(SK, LinkFromSrc) = ComdatsChosen[SC];
- if (LinkFromSrc)
- ValuesToLink.insert(&GV);
- return false;
+ if (!LinkFromSrc)
+ return false;
}
bool LinkFromSrc = true;
@@ -565,7 +564,8 @@ bool ModuleLinker::run() {
if (!SC)
continue;
for (GlobalValue *GV2 : ComdatMembers[SC])
- ValuesToLink.insert(GV2);
+ if (GV2->hasInternalLinkage())
+ ValuesToLink.insert(GV2);
}
if (shouldInternalizeLinkedSymbols()) {
OpenPOWER on IntegriCloud