LLVM: Install error reporting handler

This commit is contained in:
Elad 2025-01-10 20:45:32 +02:00
parent 10d038e43f
commit 64c53fcc61

View File

@ -565,6 +565,18 @@ jit_compiler::jit_compiler(const std::unordered_map<std::string, u64>& _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<llvm::Module> ("null_", *m_context);