Restore POSIX signal handling on MacOS behind a feature flag (#3063)

* Restore POSIX signal handling on MacOS behind a feature flag

As described in Issue #3052, the switch to Mach Exception handling
removed `unix::StoreExt` from the public API of crate on MacOS.
That is a breaking change and makes it difficult for some
application to upgrade to the current stable Wasmtime.

As a workaround this PR introduces a feature flag called
`posix-signals-on-macos` that restores the old behaviour on MacOS.
The flag is disabled by default.

* Fix test guard

* Fix formatting in the test
This commit is contained in:
Ulan Degenbaev
2021-07-12 23:25:44 +02:00
committed by GitHub
parent 808582826b
commit f08491eeca
7 changed files with 99 additions and 4 deletions

View File

@@ -81,3 +81,8 @@ uffd = ["wasmtime-runtime/uffd"]
# Enables support for all architectures in JIT and the `wasmtime compile` CLI command.
all-arch = ["wasmtime-jit/all-arch"]
# Enables trap handling using POSIX signals instead of Mach exceptions on MacOS.
# It is useful for applications that do not bind their own exception ports and
# need portable signal handling.
posix-signals-on-macos = ["wasmtime-runtime/posix-signals-on-macos"]

View File

@@ -401,7 +401,7 @@ pub use crate::types::*;
pub use crate::values::*;
cfg_if::cfg_if! {
if #[cfg(target_os = "macos")] {
if #[cfg(all(target_os = "macos", not(feature = "posix-signals-on-macos")))] {
// no extensions for macOS at this time
} else if #[cfg(unix)] {
pub mod unix;