Register LLVM handlers for bad-alloc / OOM
LLVM's default bad-alloc handler may throw if exceptions are enabled, and `operator new` isn't hooked at all by default. Now we register our own handler that prints a message similar to fatal errors, then aborts. We also call the function that registers the C++ `std::new_handler`.
This commit is contained in:
parent
1ca424ca43
commit
0ade5a11f5
3 changed files with 26 additions and 3 deletions
|
@ -49,7 +49,7 @@ unsafe fn configure_llvm(sess: &Session) {
|
|||
let mut llvm_c_strs = Vec::with_capacity(n_args + 1);
|
||||
let mut llvm_args = Vec::with_capacity(n_args + 1);
|
||||
|
||||
llvm::LLVMRustInstallFatalErrorHandler();
|
||||
llvm::LLVMRustInstallErrorHandlers();
|
||||
// On Windows, an LLVM assertion will open an Abort/Retry/Ignore dialog
|
||||
// box for the purpose of launching a debugger. However, on CI this will
|
||||
// cause it to hang until it times out, which can take several hours.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue