diff --git a/lib/execute/signalhandlers/SignalHandlers.cpp b/lib/execute/signalhandlers/SignalHandlers.cpp index 59b8e45810..71ba9c3a02 100644 --- a/lib/execute/signalhandlers/SignalHandlers.cpp +++ b/lib/execute/signalhandlers/SignalHandlers.cpp @@ -15,6 +15,7 @@ #elif defined(__APPLE__) # include # include +# include #else # include #endif @@ -520,7 +521,6 @@ HandleMachException(const ExceptionRequest& request) } { - AutoNoteSingleThreadedRegion anstr; AutoHandlingTrap aht; if (!HandleTrap(&context)) { return false; @@ -542,8 +542,8 @@ HandleMachException(const ExceptionRequest& request) static mach_port_t sMachDebugPort = MACH_PORT_NULL; -static void -MachExceptionHandlerThread(void *arg) +static void* +MachExceptionHandlerThread(void* arg) { // Taken from mach_exc in /usr/include/mach/mach_exc.defs. static const unsigned EXCEPTION_MSG_ID = 2405; @@ -588,6 +588,8 @@ MachExceptionHandlerThread(void *arg) mach_msg(&reply.Head, MACH_SEND_MSG, sizeof(reply), 0, MACH_PORT_NULL, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); } + + return nullptr; } #else // If not Windows or Mac, assume Unix @@ -769,7 +771,7 @@ EnsureDarwinMachPorts() if (r != 0) { return false; } - r = pthread_detach(&handlerThread); + r = pthread_detach(handlerThread); assert(r != 0); // In addition to the process-wide signal handler setup, OSX needs each @@ -781,7 +783,7 @@ EnsureDarwinMachPorts() // uses of thread-level exception ports. assert(sMachDebugPort != MACH_PORT_NULL); thread_port_t thisThread = mach_thread_self(); - kern_return_t kret = thread_set_exception_ports(thisThread, + kret = thread_set_exception_ports(thisThread, EXC_MASK_BAD_ACCESS | EXC_MASK_BAD_INSTRUCTION, sMachDebugPort, EXCEPTION_DEFAULT | MACH_EXCEPTION_CODES, diff --git a/lib/execute/signalhandlers/SignalHandlers.h b/lib/execute/signalhandlers/SignalHandlers.h index 99999d9d6b..1ab7ceb1b1 100644 --- a/lib/execute/signalhandlers/SignalHandlers.h +++ b/lib/execute/signalhandlers/SignalHandlers.h @@ -46,7 +46,7 @@ EnsureEagerSignalHandlers(void); // be performed per-thread. This operation may incur some overhead and // so should be done only when needed to use wasm. bool -EnsureDarwinMachPorts(struct TrapContext* cx); +EnsureDarwinMachPorts(void); #ifdef __cplusplus } // extern "C" diff --git a/lib/execute/src/traphandlers.rs b/lib/execute/src/traphandlers.rs index 9d1f4efe81..b943e3d3c7 100644 --- a/lib/execute/src/traphandlers.rs +++ b/lib/execute/src/traphandlers.rs @@ -41,9 +41,9 @@ pub extern "C" fn RecordTrap(pc: *const u8, _codeSegment: *const CodeSegment) { #[allow(non_snake_case)] #[no_mangle] pub extern "C" fn Unwind() { - JMP_BUFS.with(|bufs| unsafe { + JMP_BUFS.with(|bufs| { let buf = bufs.borrow_mut().pop().unwrap(); - longjmp(&buf, 1); + unsafe { longjmp(&buf, 1) }; }) }