Skip to content

Commit 5448070

Browse files
committed
Cranelift: Revert raw-dylib for Windows futex APIs
1 parent e3078f8 commit 5448070

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
From 231e20fe3e14a38fbb99c3175e2c130cf5be9967 Mon Sep 17 00:00:00 2001
2+
From: Chris Denton <[email protected]>
3+
Date: Tue, 16 Apr 2024 14:34:28 +0000
4+
Subject: [PATCH] Revert use raw-dylib for Windows futex APIs
5+
6+
---
7+
library/std/src/sys/pal/windows/c.rs | 40 +++++++++-------------------
8+
1 file changed, 12 insertions(+), 28 deletions(-)
9+
10+
diff --git a/library/std/src/sys/pal/windows/c.rs b/library/std/src/sys/pal/windows/c.rs
11+
index 503fada6a46..1c828bac4b6 100644
12+
--- a/library/std/src/sys/pal/windows/c.rs
13+
+++ b/library/std/src/sys/pal/windows/c.rs
14+
@@ -356,34 +356,18 @@ pub fn GetTempPath2W(bufferlength: u32, buffer: PWSTR) -> u32 {
15+
}
16+
}
17+
18+
-// Use raw-dylib to import synchronization functions to workaround issues with the older mingw import library.
19+
-cfg_if::cfg_if! {
20+
-if #[cfg(not(target_vendor = "win7"))] {
21+
- #[cfg(target_arch = "x86")]
22+
- #[link(name = "api-ms-win-core-synch-l1-2-0", kind = "raw-dylib", import_name_type = "undecorated")]
23+
- extern "system" {
24+
- pub fn WaitOnAddress(
25+
- address: *const c_void,
26+
- compareaddress: *const c_void,
27+
- addresssize: usize,
28+
- dwmilliseconds: u32,
29+
- ) -> BOOL;
30+
- pub fn WakeByAddressSingle(address: *const c_void);
31+
- pub fn WakeByAddressAll(address: *const c_void);
32+
- }
33+
- #[cfg(not(target_arch = "x86"))]
34+
- #[link(name = "api-ms-win-core-synch-l1-2-0", kind = "raw-dylib")]
35+
- extern "system" {
36+
- pub fn WaitOnAddress(
37+
- address: *const c_void,
38+
- compareaddress: *const c_void,
39+
- addresssize: usize,
40+
- dwmilliseconds: u32,
41+
- ) -> BOOL;
42+
- pub fn WakeByAddressSingle(address: *const c_void);
43+
- pub fn WakeByAddressAll(address: *const c_void);
44+
- }
45+
-}}
46+
+#[cfg(not(target_vendor = "win7"))]
47+
+#[link(name = "synchronization")]
48+
+extern "system" {
49+
+ pub fn WaitOnAddress(
50+
+ address: *const c_void,
51+
+ compareaddress: *const c_void,
52+
+ addresssize: usize,
53+
+ dwmilliseconds: u32,
54+
+ ) -> BOOL;
55+
+ pub fn WakeByAddressSingle(address: *const c_void);
56+
+ pub fn WakeByAddressAll(address: *const c_void);
57+
+}
58+
59+
#[cfg(target_vendor = "win7")]
60+
compat_fn_optional! {
61+
--
62+
2.42.0.windows.2
63+

0 commit comments

Comments
 (0)