diff --git a/llvm/include/llvm/ExecutionEngine/RuntimeDyld.h b/llvm/include/llvm/ExecutionEngine/RuntimeDyld.h index 0b6b75be48b3..8d7b81bb6e2b 100644 --- a/llvm/include/llvm/ExecutionEngine/RuntimeDyld.h +++ b/llvm/include/llvm/ExecutionEngine/RuntimeDyld.h @@ -84,6 +84,7 @@ public: void deregisterEHFrames(); + bool hasError(); StringRef getErrorString(); /// By default, only sections that are "required for execution" are passed to diff --git a/llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp b/llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp index aa5f72402451..49b67275615c 100644 --- a/llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp +++ b/llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp @@ -115,7 +115,7 @@ bool MCJIT::removeModule(Module *M) { void MCJIT::addObjectFile(object::ObjectFile *Obj) { ObjectImage *LoadedObject = Dyld.loadObject(Obj); - if (!LoadedObject) + if (!LoadedObject || Dyld.hasError()) report_fatal_error(Dyld.getErrorString()); LoadedObjects.push_back(LoadedObject); diff --git a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp index 7f3508374826..12cd81931ffd 100644 --- a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp +++ b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp @@ -761,6 +761,8 @@ void RuntimeDyld::mapSectionAddress(const void *LocalAddress, Dyld->mapSectionAddress(LocalAddress, TargetAddress); } +bool RuntimeDyld::hasError() { return Dyld->hasError(); } + StringRef RuntimeDyld::getErrorString() { return Dyld->getErrorString(); } void RuntimeDyld::registerEHFrames() {