diff options
Diffstat (limited to 'llvm/lib/ExecutionEngine')
-rw-r--r-- | llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp b/llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp index 6cbebe98e7c..938b9fb7a54 100644 --- a/llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp +++ b/llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp @@ -206,8 +206,15 @@ void MCJIT::generateCodeForModule(Module *M) { // Load the object into the dynamic linker. // MCJIT now owns the ObjectImage pointer (via its LoadedObjects list). - ErrorOr<std::unique_ptr<object::ObjectFile>> LoadedObject = + Expected<std::unique_ptr<object::ObjectFile>> LoadedObject = object::ObjectFile::createObjectFile(ObjectToLoad->getMemBufferRef()); + if (!LoadedObject) { + std::string Buf; + raw_string_ostream OS(Buf); + logAllUnhandledErrors(LoadedObject.takeError(), OS, ""); + OS.flush(); + report_fatal_error(Buf); + } std::unique_ptr<RuntimeDyld::LoadedObjectInfo> L = Dyld.loadObject(*LoadedObject.get()); |