Skip to content

Commit 6ca0092

Browse files
committed
Add emscripten_wasm_eh cfg flag and use it to adjust the libraries
1 parent 6e9ff3f commit 6ca0092

File tree

4 files changed

+13
-2
lines changed

4 files changed

+13
-2
lines changed

compiler/rustc_session/src/config/cfg.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ pub(crate) fn disallow_cfgs(sess: &Session, user_cfgs: &Cfg) {
143143
| (sym::target_has_atomic_load_store, Some(_))
144144
| (sym::target_thread_local, None) => disallow(cfg, "--target"),
145145
(sym::fmt_debug, None | Some(_)) => disallow(cfg, "-Z fmt-debug"),
146+
(sym::emscripten_wasm_eh, None | Some(_)) => disallow(cfg, "-Z emscripten_wasm_eh"),
146147
_ => {}
147148
}
148149
}
@@ -295,6 +296,9 @@ pub(crate) fn default_configuration(sess: &Session) -> Cfg {
295296
ins_none!(sym::ub_checks);
296297
}
297298

299+
if sess.opts.unstable_opts.emscripten_wasm_eh {
300+
ins_none!(sym::emscripten_wasm_eh);
301+
}
298302
ret
299303
}
300304

compiler/rustc_span/src/symbol.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -823,6 +823,7 @@ symbols! {
823823
emit_enum_variant_arg,
824824
emit_struct,
825825
emit_struct_field,
826+
emscripten_wasm_eh,
826827
enable,
827828
encode,
828829
end,

library/panic_unwind/src/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ use core::any::Any;
3131
use core::panic::PanicPayload;
3232

3333
cfg_if::cfg_if! {
34-
if #[cfg(target_os = "hermit")] {
34+
if #[cfg(all(target_os = "emscripten", not(emscripten_wasm_eh)))] {
35+
#[path = "emcc.rs"]
36+
mod imp;
37+
} else if #[cfg(target_os = "hermit")] {
3538
#[path = "hermit.rs"]
3639
mod imp;
3740
} else if #[cfg(target_os = "l4re")] {

library/unwind/src/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
#![feature(link_cfg)]
44
#![feature(staged_api)]
55
#![cfg_attr(not(target_env = "msvc"), feature(libc))]
6-
#![cfg_attr(all(target_family = "wasm"), feature(simd_wasm64, wasm_exception_handling_intrinsics))]
6+
#![cfg_attr(
7+
all(target_family = "wasm", any(not(target_os = "emscripten"), emscripten_wasm_eh)),
8+
feature(simd_wasm64, wasm_exception_handling_intrinsics)
9+
)]
710
#![allow(internal_features)]
811

912
// Force libc to be included even if unused. This is required by many platforms.

0 commit comments

Comments
 (0)