diff options
| author | Rafael Espindola <rafael.espindola@gmail.com> | 2016-04-21 14:56:33 +0000 |
|---|---|---|
| committer | Rafael Espindola <rafael.espindola@gmail.com> | 2016-04-21 14:56:33 +0000 |
| commit | 15ca14c0b9f750caca034de96f0e980b7fa8b5c9 (patch) | |
| tree | 3a5ca1eba490d88c930977f432d14e6658b66da9 /llvm/lib | |
| parent | bf8b5f8dd2331870ee4ca0a3e242b98903293631 (diff) | |
| download | bcm5719-llvm-15ca14c0b9f750caca034de96f0e980b7fa8b5c9.tar.gz bcm5719-llvm-15ca14c0b9f750caca034de96f0e980b7fa8b5c9.zip | |
Fix recursive -only-needed.
We were assuming that only linkonce_odr GVs were lazy linked.
llvm-svn: 266995
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Linker/IRMover.cpp | 4 | ||||
| -rw-r--r-- | llvm/lib/Linker/LinkModules.cpp | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Linker/IRMover.cpp b/llvm/lib/Linker/IRMover.cpp index b4d91d186e1..1100daf7116 100644 --- a/llvm/lib/Linker/IRMover.cpp +++ b/llvm/lib/Linker/IRMover.cpp @@ -849,9 +849,11 @@ bool IRLinker::shouldLink(GlobalValue *DGV, GlobalValue &SGV) { if (SGV.hasAvailableExternallyLinkage()) return true; - if (DoneLinkingBodies) + if (SGV.isDeclaration()) return false; + if (DoneLinkingBodies) + return false; // Callback to the client to give a chance to lazily add the Global to the // list of value to link. diff --git a/llvm/lib/Linker/LinkModules.cpp b/llvm/lib/Linker/LinkModules.cpp index 8ed885649ca..5b713fe29fb 100644 --- a/llvm/lib/Linker/LinkModules.cpp +++ b/llvm/lib/Linker/LinkModules.cpp @@ -423,7 +423,7 @@ void ModuleLinker::addLazyFor(GlobalValue &GV, IRMover::ValueAdder Add) { return; // Add these to the internalize list - if (!GV.hasLinkOnceLinkage()) + if (!GV.hasLinkOnceLinkage() && !shouldLinkOnlyNeeded()) return; if (shouldInternalizeLinkedSymbols()) |

