-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change default panic strategy to abort for wasm32-unknown-emscripten #89762
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @michaelwoerister (or someone else) soon. Please see the contribution instructions for more information. |
|
Thanks for the PR, @nedv-eu! I don't feel qualified to review this. Does anyone in @rust-lang/compiler-contributors know more about this topic? |
The change makes sense to me, but I'm not familiar with emscripten specifically. Do we have a maintainer for that target? |
r? @pnkfelix for re-assignment -- maybe we should discuss in the triage meeting? |
Based on rust/compiler/rustc_codegen_ssa/src/back/link.rs Lines 1950 to 1957 in bb918d0
and https://github.com/rust-lang/rust/blob/673d0db5e393e9c64897005b470bfeb6d5aec61b/library/panic_unwind/src/emcc.rs it looks like we do try to support exceptions with emscripten. |
Yes, seems like there was an attempt to support this. However since it is broken and the fact that enabling exceptions involves a lot of overhead (see https://emscripten.org/docs/porting/exceptions.html) I believe it is the better option to use abort panic strategy by default - as is the case for other wasm targets. |
nominating for discussion in T-compiler meeting about whether we should just adopt approach given here, or if we should expend effort figuring out the exception situation for emscripten. |
Waiting on @pnkfelix for review and approval per last weeks' compiler team meeting. |
Alternatively, if team doesn't feel the default strategy can be changed, this can be fixed by allowing the emscripten arguments to be passed to the linker, instead overriden. Related bug - #41750 |
The problem is that __gxx_personality_v0 symbol actually is undefined and panic unwind code is using it. Disabling errors on undefined symbols only masks the problem. Panic unwind at runtime will still crash on undefined symbol. And not only this one but any other undefined symbol error will be caught not during link time but at runtime. That is unacceptable as per fail early rule. |
@bors r+ |
📌 Commit 8b8bbf0 has been approved by |
Change default panic strategy to abort for wasm32-unknown-emscripten Emscripten v2.0.10 removed __gxx_personality_v0 function stub that panic-unwind in wam32-unknown-emscripten target depends on. This causes linker error when using newer versions of emscripten compiler. As mentioned in rust-lang#85821 (comment) the __gxx_personality_v0 function was just a stub in emscripten for several years and therefor the panic-unwind strategy was broken all the time. Changing default to abort fixes builds (issue 85821) with recent version of emscripten yet we are not loosing any functionality as the panic-unwind was broken anyway. Fixes rust-lang#85821
@bors r- |
@bors rollup=iffy |
@nedv-eu any updates on the rollup failure? |
Sorry for delay. For some reason I missed previous notifications in this topic. I went through the failing tests and it seems they are not supposed to be run in this case. There is always a comment "ignore-wasm32-bare compiled with panic=abort by default" |
I suspect ignore-wasm32-bare only applies to wasm32-unknown-unknown and not -emscripten. Try ignore-wasm32 without -bare. |
@nedv-eu any updates on this? |
In the end I based my project on wasm32-unknown-unknown. Unfortunately I cannot invest more effort in fixing emscripten target. Feel free to close this unless there is someone else interested in using wasm32-unknown-emscripten target. Since it is broken for quite a along time (at least with recent version of emcc) maybe it is worth considering removing the target from Tier 2? |
Closing this based on the last comment |
Emscripten v2.0.10 removed __gxx_personality_v0 function stub that panic-unwind in wam32-unknown-emscripten target depends on. This causes linker error when using newer versions of emscripten compiler. As mentioned in #85821 (comment) the __gxx_personality_v0 function was just a stub in emscripten for several years and therefor the panic-unwind strategy was broken all the time. Changing default to abort fixes builds (issue 85821) with recent version of emscripten yet we are not loosing any functionality as the panic-unwind was broken anyway. Fixes #85821