diff --git a/Utilities/JITLLVM.cpp b/Utilities/JITLLVM.cpp index f93a46645d..1a9c9e7052 100644 --- a/Utilities/JITLLVM.cpp +++ b/Utilities/JITLLVM.cpp @@ -565,6 +565,18 @@ jit_compiler::jit_compiler(const std::unordered_map& _link, co : m_context(new llvm::LLVMContext) , m_cpu(cpu(_cpu)) { + static const bool s_install_llvm_error_handler = []() + { + llvm::remove_fatal_error_handler(); + llvm::install_fatal_error_handler([](void*, const char* msg, bool) + { + const std::string_view out = msg ? msg : ""; + fmt::throw_exception("LLVM Emergency Exit Invoked: '%s'", out); + }, nullptr); + + return true; + }(); + std::string result; auto null_mod = std::make_unique ("null_", *m_context);