aboutsummaryrefslogtreecommitdiff
path: root/lib/Linker
diff options
context:
space:
mode:
authorTanya Lattner <tonic@nondot.org>2011-10-14 22:17:46 +0000
committerTanya Lattner <tonic@nondot.org>2011-10-14 22:17:46 +0000
commit2b28a74bc69e33eedc60f438e4fe9ef9ae606f3c (patch)
treed2acf55a79c6b670467dbd960d0f95dfe2ab57bd /lib/Linker
parent008c8384346ddee44b26f0161757432d3137e7b7 (diff)
Allow the source module to be materialized during the linking process.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142010 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Linker')
-rw-r--r--lib/Linker/LinkModules.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/Linker/LinkModules.cpp b/lib/Linker/LinkModules.cpp
index 4ccabcf586..03a962e3be 100644
--- a/lib/Linker/LinkModules.cpp
+++ b/lib/Linker/LinkModules.cpp
@@ -951,8 +951,17 @@ bool ModuleLinker::run() {
// Link in the function bodies that are defined in the source module into
// DstM.
for (Module::iterator SF = SrcM->begin(), E = SrcM->end(); SF != E; ++SF) {
- // Skip if no body (function is external) or marked to skip.
- if (SF->isDeclaration() || DoNotLinkFromSource.count(SF)) continue;
+
+ // Skip if not linking from source.
+ if (DoNotLinkFromSource.count(SF)) continue;
+
+ // Skip if no body (function is external) or materialize.
+ if (SF->isDeclaration()) {
+ if (!SF->isMaterializable())
+ continue;
+ if (SF->Materialize(&ErrorMsg))
+ return true;
+ }
linkFunctionBody(cast<Function>(ValueMap[SF]), SF);
}