std: Get the standard library compiling for wasm64
This commit goes through and updates various `#[cfg]` as appropriate to get the wasm64-unknown-unknown target behaving similarly to the wasm32-unknown-unknown target. Most of this is just updating various conditions for `target_arch = "wasm32"` to also account for `target_arch = "wasm64"` where appropriate. This commit also lists `wasm64` as an allow-listed architecture to not have the `restricted_std` feature enabled, enabling experimentation with `-Z build-std` externally. The main goal of this commit is to enable playing around with `wasm64-unknown-unknown` externally via `-Z build-std` in a way that's similar to the `wasm32-unknown-unknown` target. These targets are effectively the same and only differ in their pointer size, but wasm64 is much newer and has much less ecosystem/library support so it'll still take time to get wasm64 fully-fledged.
This commit is contained in:
@@ -172,7 +172,7 @@ macro_rules! __thread_local_inner {
|
||||
//
|
||||
// FIXME(#84224) this should come after the `target_thread_local`
|
||||
// block.
|
||||
#[cfg(all(target_arch = "wasm32", not(target_feature = "atomics")))]
|
||||
#[cfg(all(any(target_arch = "wasm32", target_arch = "wasm64"), not(target_feature = "atomics")))]
|
||||
{
|
||||
static mut VAL: $t = $init;
|
||||
Some(&VAL)
|
||||
@@ -181,7 +181,10 @@ macro_rules! __thread_local_inner {
|
||||
// If the platform has support for `#[thread_local]`, use it.
|
||||
#[cfg(all(
|
||||
target_thread_local,
|
||||
not(all(target_arch = "wasm32", not(target_feature = "atomics"))),
|
||||
not(all(
|
||||
any(target_arch = "wasm32", target_arch = "wasm64"),
|
||||
not(target_feature = "atomics"),
|
||||
)),
|
||||
))]
|
||||
{
|
||||
// If a dtor isn't needed we can do something "very raw" and
|
||||
@@ -238,7 +241,10 @@ macro_rules! __thread_local_inner {
|
||||
// same implementation as below for os thread locals.
|
||||
#[cfg(all(
|
||||
not(target_thread_local),
|
||||
not(all(target_arch = "wasm32", not(target_feature = "atomics"))),
|
||||
not(all(
|
||||
any(target_arch = "wasm32", target_arch = "wasm64"),
|
||||
not(target_feature = "atomics"),
|
||||
)),
|
||||
))]
|
||||
{
|
||||
#[inline]
|
||||
@@ -285,21 +291,21 @@ macro_rules! __thread_local_inner {
|
||||
// The issue of "should enable on Windows sometimes" is #84933
|
||||
#[cfg_attr(not(windows), inline)]
|
||||
unsafe fn __getit() -> $crate::option::Option<&'static $t> {
|
||||
#[cfg(all(target_arch = "wasm32", not(target_feature = "atomics")))]
|
||||
#[cfg(all(any(target_arch = "wasm32", target_arch = "wasm64"), not(target_feature = "atomics")))]
|
||||
static __KEY: $crate::thread::__StaticLocalKeyInner<$t> =
|
||||
$crate::thread::__StaticLocalKeyInner::new();
|
||||
|
||||
#[thread_local]
|
||||
#[cfg(all(
|
||||
target_thread_local,
|
||||
not(all(target_arch = "wasm32", not(target_feature = "atomics"))),
|
||||
not(all(any(target_arch = "wasm32", target_arch = "wasm64"), not(target_feature = "atomics"))),
|
||||
))]
|
||||
static __KEY: $crate::thread::__FastLocalKeyInner<$t> =
|
||||
$crate::thread::__FastLocalKeyInner::new();
|
||||
|
||||
#[cfg(all(
|
||||
not(target_thread_local),
|
||||
not(all(target_arch = "wasm32", not(target_feature = "atomics"))),
|
||||
not(all(any(target_arch = "wasm32", target_arch = "wasm64"), not(target_feature = "atomics"))),
|
||||
))]
|
||||
static __KEY: $crate::thread::__OsLocalKeyInner<$t> =
|
||||
$crate::thread::__OsLocalKeyInner::new();
|
||||
@@ -479,10 +485,10 @@ mod lazy {
|
||||
}
|
||||
}
|
||||
|
||||
/// On some platforms like wasm32 there's no threads, so no need to generate
|
||||
/// On some platforms like wasm there's no threads, so no need to generate
|
||||
/// thread locals and we can instead just use plain statics!
|
||||
#[doc(hidden)]
|
||||
#[cfg(all(target_arch = "wasm32", not(target_feature = "atomics")))]
|
||||
#[cfg(all(any(target_arch = "wasm32", target_arch = "wasm64"), not(target_feature = "atomics")))]
|
||||
pub mod statik {
|
||||
use super::lazy::LazyKeyInner;
|
||||
use crate::fmt;
|
||||
|
||||
Reference in New Issue
Block a user