Skip to content

Commit

Permalink
Unconditionally pass -wasm-enable-eh
Browse files Browse the repository at this point in the history
  • Loading branch information
coolreader18 committed Feb 22, 2024
1 parent 861c7e7 commit 658a0a2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
12 changes: 6 additions & 6 deletions compiler/rustc_codegen_llvm/src/llvm_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,12 @@ unsafe fn configure_llvm(sess: &Session) {
}
}

if sess.panic_strategy() == PanicStrategy::Unwind {
if sess.target.os == "emscripten" {
add("-enable-emscripten-cxx-exceptions", false);
} else if wants_wasm_eh(sess) {
add("-wasm-enable-eh", false);
}
if wants_wasm_eh(sess) {
add("-wasm-enable-eh", false);
}

if sess.target.os == "emscripten" && sess.panic_strategy() == PanicStrategy::Unwind {
add("-enable-emscripten-cxx-exceptions", false);
}

// HACK(eddyb) LLVM inserts `llvm.assume` calls to preserve align attributes
Expand Down
7 changes: 1 addition & 6 deletions library/panic_unwind/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,7 @@ cfg_if::cfg_if! {
))] {
#[path = "gcc.rs"]
mod real_imp;
} else if #[cfg(all(target_family = "wasm", panic = "unwind"))] {
// for now, PanicStrategy::Unwind is not the default for wasm targets,
// so we need the panic = "unwind" in the cfg above. to use llvm.wasm.throw,
// we need to pass -wasm-enable-eh to LLVM, but that only happens if rustc
// is compiling with -C panic=unwind. So, this lets us -Zbuild-std with
// panic=unwind, while keeping the default panic=abort working.
} else if #[cfg(target_family = "wasm")] {
#[path = "wasm.rs"]
mod real_imp;
} else {
Expand Down

0 comments on commit 658a0a2

Please sign in to comment.