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

Avoid __cxa_thread_atexit_impl on Emscripten #106779

Merged
merged 2 commits into from
Jan 26, 2023
Merged

Commits on Jan 12, 2023

  1. Avoid __cxa_thread_atexit_impl on Emscripten

     - Fixes rust-lang#91628.
     - Fixes emscripten-core/emscripten#15722.
    
    See discussion in both issues.
    
    The TL;DR is that weak linkage causes LLVM to produce broken Wasm, presumably due to pointer mismatch. The code is casting a void pointer to a function pointer with specific signature, but Wasm is very strict about function pointer compatibility, so the resulting code is invalid.
    
    Ideally LLVM should catch this earlier in the process rather than emit invalid Wasm, but it currently doesn't and this is an easy and valid fix, given that Emcripten doesn't have `__cxa_thread_atexit_impl` these days anyway.
    
    Unfortunately, I can't add a regression test as even after looking into this issue for a long time, I couldn't reproduce it with any minimal Rust example, only with extracted LLVM IR or on a large project involving Rust + C++.
    
    r? @alexcrichton
    RReverser authored Jan 12, 2023
    Configuration menu
    Copy the full SHA
    6155b9a View commit details
    Browse the repository at this point in the history

Commits on Jan 14, 2023

  1. Configuration menu
    Copy the full SHA
    a41c5f9 View commit details
    Browse the repository at this point in the history