1
Fork 0

Rollup merge of #131830 - hoodmane:emscripten-wasm-eh, r=workingjubilee

Add support for wasm exception handling to Emscripten target

This is a draft because we need some additional setting for the Emscripten target to select between the old exception handling and the new exception handling. I don't know how to add a setting like that, would appreciate advice from Rust folks. We could maybe choose to use the new exception handling if `Ctarget-feature=+exception-handling` is passed? I tried this but I get errors from llvm so I'm not doing it right.
This commit is contained in:
Jacob Pratt 2025-01-06 22:04:13 -05:00 committed by GitHub
commit 4e4a93c2dd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 131 additions and 10 deletions

View file

@ -143,6 +143,7 @@ pub(crate) fn disallow_cfgs(sess: &Session, user_cfgs: &Cfg) {
| (sym::target_has_atomic_load_store, Some(_))
| (sym::target_thread_local, None) => disallow(cfg, "--target"),
(sym::fmt_debug, None | Some(_)) => disallow(cfg, "-Z fmt-debug"),
(sym::emscripten_wasm_eh, None | Some(_)) => disallow(cfg, "-Z emscripten_wasm_eh"),
_ => {}
}
}
@ -295,6 +296,10 @@ pub(crate) fn default_configuration(sess: &Session) -> Cfg {
ins_none!(sym::ub_checks);
}
// Nightly-only implementation detail for the `panic_unwind` and `unwind` crates.
if sess.is_nightly_build() && sess.opts.unstable_opts.emscripten_wasm_eh {
ins_none!(sym::emscripten_wasm_eh);
}
ret
}

View file

@ -1771,6 +1771,8 @@ options! {
"emit a section containing stack size metadata (default: no)"),
emit_thin_lto: bool = (true, parse_bool, [TRACKED],
"emit the bc module with thin LTO info (default: yes)"),
emscripten_wasm_eh: bool = (false, parse_bool, [TRACKED],
"Use WebAssembly error handling for wasm32-unknown-emscripten"),
enforce_type_length_limit: bool = (false, parse_bool, [TRACKED],
"enforce the type length limit when monomorphizing instances in codegen"),
export_executable_symbols: bool = (false, parse_bool, [TRACKED],