about summary refs log tree commit diff
path: root/compiler/rustc_mir_transform/src/coverage/debug.rs
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-01-26 07:53:22 +0100
committerGitHub <noreply@github.com>2023-01-26 07:53:22 +0100
commitcc92bdb9c99b944b77833f3f2cd0e362c94bf861 (patch)
tree26d0c7d4330ac06aafbdc5702ad2752fc8463b2d /compiler/rustc_mir_transform/src/coverage/debug.rs
parentb2448f9f9c8f22296e01072613fc17f69776280f (diff)
parenta41c5f9c381aeb6cb29afd1a0ca79f31d257cd6c (diff)
downloadrust-cc92bdb9c99b944b77833f3f2cd0e362c94bf861.tar.gz
rust-cc92bdb9c99b944b77833f3f2cd0e362c94bf861.zip
Rollup merge of #106779 - RReverser:patch-2, r=Mark-Simulacrum
Avoid __cxa_thread_atexit_impl on Emscripten

 - Fixes https://github.com/rust-lang/rust/issues/91628.
 - Fixes https://github.com/emscripten-core/emscripten/issues/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++.
Diffstat (limited to 'compiler/rustc_mir_transform/src/coverage/debug.rs')
0 files changed, 0 insertions, 0 deletions