Skip to content

Commit

Permalink
Fix emscripten-wasm-eh with unwind=abort
Browse files Browse the repository at this point in the history
If we build the standard library with wasm-eh then we need to link
with `-fwasm-exceptions` even if we compile with `panic=abort`
Without this change, linking a `panic=abort` crate fails with:
`undefined symbol: __cpp_exception`.

Followup to #131830.
  • Loading branch information
hoodmane committed Jan 13, 2025
1 parent 7a202a9 commit 4d0a838
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions compiler/rustc_codegen_ssa/src/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2451,10 +2451,10 @@ fn add_order_independent_options(
}

if sess.target.os == "emscripten" {
cmd.cc_arg(if sess.panic_strategy() == PanicStrategy::Abort {
"-sDISABLE_EXCEPTION_CATCHING=1"
} else if sess.opts.unstable_opts.emscripten_wasm_eh {
cmd.cc_arg(if sess.opts.unstable_opts.emscripten_wasm_eh {
"-fwasm-exceptions"
} else if sess.panic_strategy() == PanicStrategy::Abort {
"-sDISABLE_EXCEPTION_CATCHING=1"
} else {
"-sDISABLE_EXCEPTION_CATCHING=0"
});
Expand Down

0 comments on commit 4d0a838

Please sign in to comment.