[llvm-commits] [llvm] r142010 - /llvm/trunk/lib/Linker/LinkModules.cpp

Tanya Lattner tonic at nondot.org
Fri Oct 14 15:17:46 PDT 2011


Author: tbrethou
Date: Fri Oct 14 17:17:46 2011
New Revision: 142010

URL: http://llvm.org/viewvc/llvm-project?rev=142010&view=rev
Log:
Allow the source module to be materialized during the linking process.

Modified:
    llvm/trunk/lib/Linker/LinkModules.cpp

Modified: llvm/trunk/lib/Linker/LinkModules.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Linker/LinkModules.cpp?rev=142010&r1=142009&r2=142010&view=diff
==============================================================================
--- llvm/trunk/lib/Linker/LinkModules.cpp (original)
+++ llvm/trunk/lib/Linker/LinkModules.cpp Fri Oct 14 17:17:46 2011
@@ -951,8 +951,17 @@
   // 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);
   }





More information about the llvm-commits mailing list