rust/library/std/src/sys
Matthias Krüger cc92bdb9c9
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++.
2023-01-26 07:53:22 +01:00
..
common Remove redundant all in cfg 2022-11-26 09:31:40 +00:00
hermit refactor[std]: do not use box syntax 2023-01-17 14:08:35 +01:00
itron Remove various double spaces in source comments. 2023-01-14 17:22:04 +01:00
sgx std: rename Parker::new to Parker::new_in_place, add safe Parker::new constructor for SGX 2022-12-30 15:49:47 +01:00
solid refactor[std]: do not use box syntax 2023-01-17 14:08:35 +01:00
unix Rollup merge of #106779 - RReverser:patch-2, r=Mark-Simulacrum 2023-01-26 07:53:22 +01:00
unsupported Auto merge of #105698 - joboet:unsupported_threads_once, r=thomcc 2022-12-19 16:46:57 +00:00
wasi std: use a more efficient Once on platforms without threads 2022-12-14 13:55:30 +01:00
wasm std: use a more efficient Once on platforms without threads 2022-12-14 13:55:30 +01:00
windows refactor[std]: do not use box syntax 2023-01-17 14:08:35 +01:00
mod.rs Reduce CString allocations in std as much as possible 2022-10-03 11:13:17 -07:00