1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00

[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
This commit is contained in:
Lang Hames 2018-06-12 20:43:15 +00:00
parent 4239933fa7
commit f02ed7b1ef

View File

@ -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.