Skip to content
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

Don't use __gxx_personality_v0 in panic_unwind on emscripten target #97888

Merged
merged 4 commits into from
Jun 10, 2022

Conversation

hoodmane
Copy link
Contributor

@hoodmane hoodmane commented Jun 8, 2022

This resolves #85821. See also the discussion here:
emscripten-core/emscripten#17128

The consensus seems to be that rust_eh_personality is never invoked.
I patched __gxx_personality_v0 to log invocations and then ran
various panic tests and it was never called, so this analysis matches
what seems to happen in practice. This replaces the definition with
an abort, modeled on the structured exception handling implementation.

This resolves rust-lang#85821. See also the discussion here:
emscripten-core/emscripten#17128

The consensus seems to be that rust_eh_personality is never invoked.
I patched __gxx_personality_v0 to log invocations and then ran
various panic tests and it was never called, so this analysis matches
what seems to happen in practice. This replaces the definition with
an abort, modeled on the structured exception handling implementation.
@rustbot rustbot added the T-libs Relevant to the library team, which will review and decide on the PR/issue. label Jun 8, 2022
@rust-highfive
Copy link
Collaborator

Hey! It looks like you've submitted a new PR for the library teams!

If this PR contains changes to any rust-lang/rust public library APIs then please comment with @rustbot label +T-libs-api -T-libs to tag it appropriately. If this PR contains changes to any unstable APIs please edit the PR description to add a link to the relevant API Change Proposal or create one if you haven't already. If you're unsure where your change falls no worries, just leave it as is and the reviewer will take a look and make a decision to forward on if necessary.

Examples of T-libs-api changes:

  • Stabilizing library features
  • Introducing insta-stable changes such as new implementations of existing stable traits on existing stable types
  • Introducing new or changing existing unstable library APIs (excluding permanently unstable features / features without a tracking issue)
  • Changing public documentation in ways that create new stability guarantees
  • Changing observable runtime behavior of library APIs

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @joshtriplett (or someone else) soon.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 8, 2022
@rust-log-analyzer

This comment has been minimized.

@joshtriplett
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Jun 8, 2022

📌 Commit 0ec3174 has been approved by joshtriplett

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 8, 2022
@Amanieu
Copy link
Member

Amanieu commented Jun 8, 2022

@bors r-

Can you remove __gxx_personality_v0 from the extern "C" block below as well?

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jun 8, 2022
@Amanieu
Copy link
Member

Amanieu commented Jun 8, 2022

@bors r+

@bors
Copy link
Contributor

bors commented Jun 8, 2022

📌 Commit 46a3f0f has been approved by Amanieu

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 8, 2022
JohnTitor added a commit to JohnTitor/rust that referenced this pull request Jun 9, 2022
… r=Amanieu

Don't use __gxx_personality_v0 in panic_unwind on emscripten target

This resolves rust-lang#85821. See also the discussion here:
emscripten-core/emscripten#17128

The consensus seems to be that rust_eh_personality is never invoked.
I patched __gxx_personality_v0 to log invocations and then ran
various panic tests and it was never called, so this analysis matches
what seems to happen in practice. This replaces the definition with
an abort, modeled on the structured exception handling implementation.
@JohnTitor
Copy link
Member

Failed in rollup: #97909 (comment)
@bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jun 9, 2022
@Amanieu
Copy link
Member

Amanieu commented Jun 9, 2022

@bors r+

@bors
Copy link
Contributor

bors commented Jun 9, 2022

📌 Commit d2d205d has been approved by Amanieu

@bors bors removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jun 9, 2022
@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Jun 9, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 10, 2022
Rollup of 6 pull requests

Successful merges:

 - rust-lang#97718 (Fix `delayed_good_path_bug` ice for expected diagnostics (RFC 2383))
 - rust-lang#97876 (update docs for `std::future::IntoFuture`)
 - rust-lang#97888 (Don't use __gxx_personality_v0 in panic_unwind on emscripten target)
 - rust-lang#97922 (Remove redundant calls to reserve in impl Write for VecDeque)
 - rust-lang#97927 (Do not introduce bindings for types and consts in HRTB.)
 - rust-lang#97937 (Fix a typo in `test/ui/hrtb/hrtb-just-for-static.rs`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 20be5da into rust-lang:master Jun 10, 2022
@rustbot rustbot added this to the 1.63.0 milestone Jun 10, 2022
@Jules-Bertholet
Copy link
Contributor

Jules-Bertholet commented Jun 10, 2022

I've actually had a PR open for a while now (#95950) that disables unwinding for Emscripten completely, also to address the breakage in #85821. I'm glad to see that @hoodmane found an alternative solution. However as part of the discussion around #95950, the compiler team agreed not to re-enable unwinding on Emscripten without an MCP, because of the risk that a future change to Emscripten could break everything again. It doesn't look like that process was followed here. @pnkfelix thoughts?

@hoodmane
Copy link
Contributor Author

hoodmane commented Jun 10, 2022

not to re-enable unwinding ... It doesn't look like that process was followed here

This PR didn't re-enable unwinding since it was not disabled.

@hoodmane
Copy link
Contributor Author

Probably it would be good to discuss with the emscripten team. Ideally Rust should have an error handling implementation that relies on stable interfaces from Emscripten, and the Emscripten team should maintain a stable interface that Rust can use. Also, Emscripten has two different error handling ABIs but currently Rust only supports one, in the ideal case Rust could support both.

I will open a new issue about this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O-emscripten Target: 50% off wasm32-unknown-musl. the savings come out of stdio.h, but hey, you get SDL! S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Emscripten wasm32 compilation broken
10 participants