From 2b28a74bc69e33eedc60f438e4fe9ef9ae606f3c Mon Sep 17 00:00:00 2001 From: Tanya Lattner Date: Fri, 14 Oct 2011 22:17:46 +0000 Subject: [PATCH] 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 --- lib/Linker/LinkModules.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/Linker/LinkModules.cpp b/lib/Linker/LinkModules.cpp index 4ccabcf5860..03a962e3be5 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(ValueMap[SF]), SF); } -- 2.34.1