Add bazel feature for wasm-exceptions (#1575)
This PR add bazel feature for `-fwasm-exceptions`
Part of #1400
diff --git a/bazel/emscripten_toolchain/toolchain.bzl b/bazel/emscripten_toolchain/toolchain.bzl
index ae2939f..070e3e0 100644
--- a/bazel/emscripten_toolchain/toolchain.bzl
+++ b/bazel/emscripten_toolchain/toolchain.bzl
@@ -363,6 +363,9 @@
# Set if enabling exceptions.
feature(name = "exceptions"),
+ # Set if enabling wasm_exceptions.
+ feature(name = "wasm_exceptions"),
+
# This feature overrides the default optimization to prefer execution speed
# over binary size (like clang -O3).
feature(
@@ -515,7 +518,7 @@
flags = [
"-fno-exceptions",
],
- not_features = ["exceptions"],
+ not_features = ["exceptions", "wasm_exceptions"],
),
flag_set(
actions = all_cpp_compile_actions,
@@ -524,6 +527,14 @@
],
features = ["exceptions"],
),
+ flag_set(
+ actions = all_cpp_compile_actions +
+ all_link_actions,
+ flags = [
+ "-fwasm-exceptions",
+ ],
+ features = ["wasm_exceptions"],
+ ),
# All compiles (and implicitly link)
flag_set(
actions = all_compile_actions +