about summary refs log tree commit diff
diff options
context:
space:
mode:
authorChris Denton <chris@chrisdenton.dev>2024-04-16 15:34:04 +0000
committerMark Rousskov <mark.simulacrum@gmail.com>2024-04-28 09:31:13 -0400
commit2775ae0fa9c3b6e329d8714a4c4036b8e54899bf (patch)
treeda90f9a754d4ef833288350f34aba80d125a0d95
parentdc070bc89e7cfbe5740e3fc7e12a85153834ed76 (diff)
downloadrust-2775ae0fa9c3b6e329d8714a4c4036b8e54899bf.tar.gz
rust-2775ae0fa9c3b6e329d8714a4c4036b8e54899bf.zip
Use raw-dylib for Windows futex APIs
This is a workaround for older mingw `synchronization` import library not working on at least some system.
-rw-r--r--library/std/src/sys/pal/windows/c.rs14
1 files changed, 13 insertions, 1 deletions
diff --git a/library/std/src/sys/pal/windows/c.rs b/library/std/src/sys/pal/windows/c.rs
index 1c828bac4b6..9d58ce05f01 100644
--- a/library/std/src/sys/pal/windows/c.rs
+++ b/library/std/src/sys/pal/windows/c.rs
@@ -357,7 +357,19 @@ compat_fn_with_fallback! {
 }
 
 #[cfg(not(target_vendor = "win7"))]
-#[link(name = "synchronization")]
+// Use raw-dylib to import synchronization functions to workaround issues with the older mingw import library.
+#[cfg_attr(
+    target_arch = "x86",
+    link(
+        name = "api-ms-win-core-synch-l1-2-0",
+        kind = "raw-dylib",
+        import_name_type = "undecorated"
+    )
+)]
+#[cfg_attr(
+    not(target_arch = "x86"),
+    link(name = "api-ms-win-core-synch-l1-2-0", kind = "raw-dylib")
+)]
 extern "system" {
     pub fn WaitOnAddress(
         address: *const c_void,