Skip to content

Commit 658a0a2

Browse files
committed
Unconditionally pass -wasm-enable-eh
1 parent 861c7e7 commit 658a0a2

File tree

2 files changed

+7
-12
lines changed

2 files changed

+7
-12
lines changed

Diff for: compiler/rustc_codegen_llvm/src/llvm_util.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,12 @@ unsafe fn configure_llvm(sess: &Session) {
9999
}
100100
}
101101

102-
if sess.panic_strategy() == PanicStrategy::Unwind {
103-
if sess.target.os == "emscripten" {
104-
add("-enable-emscripten-cxx-exceptions", false);
105-
} else if wants_wasm_eh(sess) {
106-
add("-wasm-enable-eh", false);
107-
}
102+
if wants_wasm_eh(sess) {
103+
add("-wasm-enable-eh", false);
104+
}
105+
106+
if sess.target.os == "emscripten" && sess.panic_strategy() == PanicStrategy::Unwind {
107+
add("-enable-emscripten-cxx-exceptions", false);
108108
}
109109

110110
// HACK(eddyb) LLVM inserts `llvm.assume` calls to preserve align attributes

Diff for: library/panic_unwind/src/lib.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,7 @@ cfg_if::cfg_if! {
6060
))] {
6161
#[path = "gcc.rs"]
6262
mod real_imp;
63-
} else if #[cfg(all(target_family = "wasm", panic = "unwind"))] {
64-
// for now, PanicStrategy::Unwind is not the default for wasm targets,
65-
// so we need the panic = "unwind" in the cfg above. to use llvm.wasm.throw,
66-
// we need to pass -wasm-enable-eh to LLVM, but that only happens if rustc
67-
// is compiling with -C panic=unwind. So, this lets us -Zbuild-std with
68-
// panic=unwind, while keeping the default panic=abort working.
63+
} else if #[cfg(target_family = "wasm")] {
6964
#[path = "wasm.rs"]
7065
mod real_imp;
7166
} else {

0 commit comments

Comments
 (0)