Skip to content

Commit 65c3de2

Browse files
committed
Cranelift: Don't use raw-dylib in std
1 parent 4cf4f2d commit 65c3de2

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
From 4b729c081aa1a4c86c12e28ce10940b95f846341 Mon Sep 17 00:00:00 2001
2+
From: Chris Denton <chris@chrisdenton.dev>
3+
Date: Tue, 20 Feb 2024 16:01:40 -0300
4+
Subject: [PATCH] Don't use raw-dylib in std
5+
6+
---
7+
library/std/src/sys/pal/windows/c.rs | 2 +-
8+
library/std/src/sys/pal/windows/rand.rs | 3 +--
9+
2 files changed, 2 insertions(+), 3 deletions(-)
10+
11+
diff --git a/library/std/src/sys/pal/windows/c.rs b/library/std/src/sys/pal/windows/c.rs
12+
index f7ebf12bd99..4c99d927c70 100644
13+
--- a/library/std/src/sys/pal/windows/c.rs
14+
+++ b/library/std/src/sys/pal/windows/c.rs
15+
@@ -323,7 +323,7 @@ pub unsafe fn NtWriteFile(
16+
17+
// Use raw-dylib to import ProcessPrng as we can't rely on there being an import library.
18+
cfg_if::cfg_if! {
19+
-if #[cfg(not(target_vendor = "win7"))] {
20+
+if #[cfg(any())] {
21+
#[cfg(target_arch = "x86")]
22+
#[link(name = "bcryptprimitives", kind = "raw-dylib", import_name_type = "undecorated")]
23+
extern "system" {
24+
diff --git a/library/std/src/sys/pal/windows/rand.rs b/library/std/src/sys/pal/windows/rand.rs
25+
index 74f26c28dd0..a755c08682e 100644
26+
--- a/library/std/src/sys/pal/windows/rand.rs
27+
+++ b/library/std/src/sys/pal/windows/rand.rs
28+
@@ -1,7 +1,7 @@
29+
use crate::mem;
30+
use crate::sys::c;
31+
32+
-#[cfg(not(target_vendor = "win7"))]
33+
+#[cfg(any())]
34+
#[inline]
35+
pub fn hashmap_random_keys() -> (u64, u64) {
36+
let mut v = (0, 0);
37+
@@ -12,7 +12,6 @@ pub fn hashmap_random_keys() -> (u64, u64) {
38+
v
39+
}
40+
41+
-#[cfg(target_vendor = "win7")]
42+
pub fn hashmap_random_keys() -> (u64, u64) {
43+
use crate::ffi::c_void;
44+
use crate::io;
45+
--
46+
2.42.0.windows.2
47+

0 commit comments

Comments
 (0)