Allow compiling the wasm32-wasi
std library with atomics
The issue #102157 demonstrates how currently the `-Z build-std` option will fail when re-compiling the standard library with `RUSTFLAGS` like `RUSTFLAGS="-C target-feature=+atomics,+bulk-memory -C link-args=--shared-memory"`. This change attempts to resolve those build issues by depending on the the WebAssembly `futex` module and providing an implementation for `env_lock`. Fixes #102157.
This commit is contained in:
parent
0265a3e93b
commit
da638b3a9f
@ -25,6 +25,9 @@
|
||||
pub mod env;
|
||||
pub mod fd;
|
||||
pub mod fs;
|
||||
#[allow(unused)]
|
||||
#[path = "../wasm/atomics/futex.rs"]
|
||||
pub mod futex;
|
||||
pub mod io;
|
||||
#[path = "../unsupported/locks/mod.rs"]
|
||||
pub mod locks;
|
||||
|
@ -24,11 +24,16 @@ mod libc {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(target_feature = "atomics"))]
|
||||
pub unsafe fn env_lock() -> impl Any {
|
||||
cfg_if::cfg_if! {
|
||||
if #[cfg(target_feature = "atomics")] {
|
||||
todo!()
|
||||
} else {
|
||||
// No need for a lock if we're single-threaded, but this function will need
|
||||
// to get implemented for multi-threaded scenarios
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn errno() -> i32 {
|
||||
extern "C" {
|
||||
|
Loading…
Reference in New Issue
Block a user