diff options
-rw-r--r-- | llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp b/llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp index 82647ea9440..2c663c2e1ed 100644 --- a/llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp +++ b/llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp @@ -142,8 +142,14 @@ void MCJIT::setObjectCache(ObjectCache* NewCache) { } std::unique_ptr<MemoryBuffer> MCJIT::emitObject(Module *M) { + assert(M && "Can not emit a null module"); + MutexGuard locked(lock); + // Materialize all globals in the module if they have not been + // materialized already. + cantFail(M->materializeAll()); + // This must be a module which has already been added but not loaded to this // MCJIT instance, since these conditions are tested by our caller, // generateCodeForModule. |