Fix emscripten-wasm-eh with unwind=abort#135450
Conversation
|
Could not assign reviewer from: |
For now, we need to use a custom rust toolchain for this. Apparently all alternatives to this don't work. -Zbuild-std doesn't work with panic=abort (rust-lang/cargo#7359) and my attempts to use a custom sysroot with either https://github.com/RalfJung/rustc-build-sysroot/ or https://github.com/DianaNites/cargo-sysroot/ seem to hit the same problem as with `-Zbuild-std`. Thus, I think the only reasonable way to go is to build the sysroot from the rust source directory. Perhaps we can eventually approach this by copying the `lib/rustlib/wasm32-unknown-emscripten/lib/` folder out of the build of the rust compiler on top of a nightly install of the compiler. For now, there is the additional problem that we need this patch to fix unwind=abort: rust-lang/rust#135450 I got my copy of the rust compiler by checking out this commit: hoodmane/rust@052ba16 two commits ahead of the rust main branch and running: ``` ./x build --stage 2 --target x86_64-unknown-linux-gnu,wasm32-unknown-emscripten ```
|
@hoodmane Can you comment that this being unconditional is needed for |
|
It's not needed for |
|
The problem with |
|
... 🫠 right, so, can the diff of this PR include a comment on why we do this |
|
If we don't, then linking fails a |
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 rust-lang#131830.
a2f19a0 to
4d0a838
Compare
|
@workingjubilee I added to the commit message:
Clear enough? |
|
cool! @bors r+ rollup |
|
Thanks for reviewing @workingjubilee! |
Rollup of 10 pull requests Successful merges: - rust-lang#134498 (Fix cycle error only occurring with -Zdump-mir) - rust-lang#134977 (Detect `mut arg: &Ty` meant to be `arg: &mut Ty` and provide structured suggestion) - rust-lang#135390 (Re-added regression test for rust-lang#122638) - rust-lang#135393 (uefi: helpers: Introduce OwnedDevicePath) - rust-lang#135440 (rm unnecessary `OpaqueTypeDecl` wrapper) - rust-lang#135441 (Make sure to mark `IMPL_TRAIT_REDUNDANT_CAPTURES` as `Allow` in edition 2024) - rust-lang#135444 (Update books) - rust-lang#135450 (Fix emscripten-wasm-eh with unwind=abort) - rust-lang#135452 (bootstrap: fix outdated feature name in comment) - rust-lang#135454 (llvm: Allow sized-word rather than ymmword in tests) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#135450 - hoodmane:wasm-eh-abort-fix, r=workingjubilee Fix emscripten-wasm-eh with unwind=abort 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 rust-lang#131830. r? workingjubilee
Rollup of 10 pull requests Successful merges: - rust-lang#134498 (Fix cycle error only occurring with -Zdump-mir) - rust-lang#134977 (Detect `mut arg: &Ty` meant to be `arg: &mut Ty` and provide structured suggestion) - rust-lang#135390 (Re-added regression test for rust-lang#122638) - rust-lang#135393 (uefi: helpers: Introduce OwnedDevicePath) - rust-lang#135440 (rm unnecessary `OpaqueTypeDecl` wrapper) - rust-lang#135441 (Make sure to mark `IMPL_TRAIT_REDUNDANT_CAPTURES` as `Allow` in edition 2024) - rust-lang#135444 (Update books) - rust-lang#135450 (Fix emscripten-wasm-eh with unwind=abort) - rust-lang#135452 (bootstrap: fix outdated feature name in comment) - rust-lang#135454 (llvm: Allow sized-word rather than ymmword in tests) r? `@ghost` `@rustbot` modify labels: rollup
If we build the standard library with wasm-eh then we need to link with
-fwasm-exceptionseven if we compile withpanic=abort.Without this change, linking a
panic=abortcrate fails with:undefined symbol: __cpp_exception.Followup to #131830.
r? workingjubilee