summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2018-06-12 20:43:15 +0000
committerLang Hames <lhames@gmail.com>2018-06-12 20:43:15 +0000
commite7989ef47fa233e1fac2d76a23fec021db69fd23 (patch)
treed281a6aa2d9379d7aee5b617010bbc953f336c50 /llvm
parent864289990ab75ee17776c599585095ec781eee6b (diff)
downloadbcm5719-llvm-e7989ef47fa233e1fac2d76a23fec021db69fd23.tar.gz
bcm5719-llvm-e7989ef47fa233e1fac2d76a23fec021db69fd23.zip
[MCJIT] Call materializeAll on modules before compiling them in MCJIT.
This only affects modules with lazy GVMaterializers attached (usually modules read off disk using the lazy bitcode reader). For such modules, materializing before compiling prevents crashes due to missing function bodies / initializers. llvm-svn: 334535
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp6
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.
OpenPOWER on IntegriCloud