Add a signal handler for macos and linux.

Implementation Notes:
- To avoid setjmp, longjmp, and the mess that those create, we instead set the interrupting
    context of the signal handler to return into the `throw_trap` routine. To my surprise,
    this actually works. The stack ends up getting unwound normally and the memory-oob error
    is caught by the trampoline.
This commit is contained in:
Lachlan Sneff
2019-03-02 17:00:05 -08:00
parent 57bfa9b0a4
commit caf2205936
6 changed files with 118 additions and 3 deletions

View File

@ -243,6 +243,10 @@ impl LLVMBackend {
)
};
unsafe {
crate::platform::install_signal_handler();
}
if res != LLVMResult::OK {
panic!("failed to load object")
}