Skip to content

Commit 07c693b

Browse files
committed
Add some patches for libstd
1 parent ed9528a commit 07c693b

File tree

2 files changed

+82
-0
lines changed

2 files changed

+82
-0
lines changed
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
From da996dae0b95f986de46a916aca00e03257ba4f9 Mon Sep 17 00:00:00 2001
2+
From: bjorn3 <[email protected]>
3+
Date: Wed, 30 Jan 2019 14:51:57 +0100
4+
Subject: [PATCH] Patch away bswap usage
5+
6+
---
7+
src/libcore/num/mod.rs | 2 +-
8+
1 file changed, 1 insertion(+), 1 deletion(-)
9+
10+
diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs
11+
index f928d40..6a146f5 100644
12+
--- a/src/libcore/num/mod.rs
13+
+++ b/src/libcore/num/mod.rs
14+
@@ -2303,7 +2303,7 @@ assert_eq!(m, ", $swapped, ");
15+
#[stable(feature = "rust1", since = "1.0.0")]
16+
#[inline]
17+
pub const fn swap_bytes(self) -> Self {
18+
- intrinsics::bswap(self as $ActualT) as Self
19+
+ 0 // bswap is unsupported by cg_clif
20+
}
21+
}
22+
23+
--
24+
2.11.0
25+

patches/0014-Don-t-use-OS-TLS.patch

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
From 1ad7a849f9ff845f676d4625ba71d1060039c0de Mon Sep 17 00:00:00 2001
2+
From: bjorn3 <[email protected]>
3+
Date: Thu, 31 Jan 2019 20:11:56 +0100
4+
Subject: [PATCH] Don't use OS TLS
5+
6+
---
7+
src/libstd/thread/local.rs | 4 ++--
8+
src/libstd/thread/mod.rs | 1 -
9+
2 files changed, 2 insertions(+), 3 deletions(-)
10+
11+
diff --git a/src/libstd/thread/local.rs b/src/libstd/thread/local.rs
12+
index 5d2eb5f..39513b6 100644
13+
--- a/src/libstd/thread/local.rs
14+
+++ b/src/libstd/thread/local.rs
15+
@@ -160,10 +160,10 @@ macro_rules! __thread_local_inner {
16+
&'static $crate::cell::UnsafeCell<
17+
$crate::option::Option<$t>>>
18+
{
19+
- #[cfg(all(target_arch = "wasm32", not(target_feature = "atomics")))]
20+
static __KEY: $crate::thread::__StaticLocalKeyInner<$t> =
21+
$crate::thread::__StaticLocalKeyInner::new();
22+
23+
+ /*
24+
#[thread_local]
25+
#[cfg(all(
26+
target_thread_local,
27+
@@ -178,6 +178,7 @@ macro_rules! __thread_local_inner {
28+
))]
29+
static __KEY: $crate::thread::__OsLocalKeyInner<$t> =
30+
$crate::thread::__OsLocalKeyInner::new();
31+
+ */
32+
33+
__KEY.get()
34+
}
35+
@@ -304,7 +305,6 @@ impl<T: 'static> LocalKey<T> {
36+
/// On some platforms like wasm32 there's no threads, so no need to generate
37+
/// thread locals and we can instead just use plain statics!
38+
#[doc(hidden)]
39+
-#[cfg(all(target_arch = "wasm32", not(target_feature = "atomics")))]
40+
pub mod statik {
41+
use cell::UnsafeCell;
42+
use fmt;
43+
diff --git a/src/libstd/thread/mod.rs b/src/libstd/thread/mod.rs
44+
index eb8e0c1..b44d737 100644
45+
--- a/src/libstd/thread/mod.rs
46+
+++ b/src/libstd/thread/mod.rs
47+
@@ -195,7 +195,6 @@ pub use self::local::{LocalKey, AccessError};
48+
// where available, but both are needed.
49+
50+
#[unstable(feature = "libstd_thread_internals", issue = "0")]
51+
-#[cfg(all(target_arch = "wasm32", not(target_feature = "atomics")))]
52+
#[doc(hidden)] pub use self::local::statik::Key as __StaticLocalKeyInner;
53+
#[unstable(feature = "libstd_thread_internals", issue = "0")]
54+
#[cfg(target_thread_local)]
55+
--
56+
2.11.0
57+

0 commit comments

Comments
 (0)