This commit is contained in:
bjorn3 2024-04-20 17:19:28 +00:00
commit 4027a520d2
3 changed files with 58 additions and 24 deletions

View File

@ -0,0 +1,37 @@
From 0d741cf82c3c908616abd39dc84ebf7d8702e0c3 Mon Sep 17 00:00:00 2001
From: Chris Denton <chris@chrisdenton.dev>
Date: Tue, 16 Apr 2024 15:51:34 +0000
Subject: [PATCH] Revert use raw-dylib for Windows futex APIs
---
library/std/src/sys/pal/windows/c.rs | 14 +-------------
1 file changed, 1 insertion(+), 13 deletions(-)
diff --git a/library/std/src/sys/pal/windows/c.rs b/library/std/src/sys/pal/windows/c.rs
index 9d58ce05f01..1c828bac4b6 100644
--- a/library/std/src/sys/pal/windows/c.rs
+++ b/library/std/src/sys/pal/windows/c.rs
@@ -357,19 +357,7 @@ pub fn GetTempPath2W(bufferlength: u32, buffer: PWSTR) -> u32 {
}
#[cfg(not(target_vendor = "win7"))]
-// 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")
-)]
+#[link(name = "synchronization")]
extern "system" {
pub fn WaitOnAddress(
address: *const c_void,
--
2.42.0.windows.2

View File

@ -110,7 +110,7 @@ pub(crate) fn codegen_const_value<'tcx>(
if fx.clif_type(layout.ty).is_some() { if fx.clif_type(layout.ty).is_some() {
return CValue::const_val(fx, layout, int); return CValue::const_val(fx, layout, int);
} else { } else {
let raw_val = int.size().truncate(int.to_bits(int.size()).unwrap()); let raw_val = int.size().truncate(int.assert_bits(int.size()));
let val = match int.size().bytes() { let val = match int.size().bytes() {
1 => fx.bcx.ins().iconst(types::I8, raw_val as i64), 1 => fx.bcx.ins().iconst(types::I8, raw_val as i64),
2 => fx.bcx.ins().iconst(types::I16, raw_val as i64), 2 => fx.bcx.ins().iconst(types::I16, raw_val as i64),
@ -491,27 +491,24 @@ pub(crate) fn mir_operand_get_const_val<'tcx>(
return None; return None;
} }
let scalar_int = mir_operand_get_const_val(fx, operand)?; let scalar_int = mir_operand_get_const_val(fx, operand)?;
let scalar_int = match fx let scalar_int =
.layout_of(*ty) match fx.layout_of(*ty).size.cmp(&scalar_int.size()) {
.size Ordering::Equal => scalar_int,
.cmp(&scalar_int.size()) Ordering::Less => match ty.kind() {
{ ty::Uint(_) => ScalarInt::try_from_uint(
Ordering::Equal => scalar_int, scalar_int.assert_uint(scalar_int.size()),
Ordering::Less => match ty.kind() { fx.layout_of(*ty).size,
ty::Uint(_) => ScalarInt::try_from_uint( )
scalar_int.try_to_uint(scalar_int.size()).unwrap(), .unwrap(),
fx.layout_of(*ty).size, ty::Int(_) => ScalarInt::try_from_int(
) scalar_int.assert_int(scalar_int.size()),
.unwrap(), fx.layout_of(*ty).size,
ty::Int(_) => ScalarInt::try_from_int( )
scalar_int.try_to_int(scalar_int.size()).unwrap(), .unwrap(),
fx.layout_of(*ty).size, _ => unreachable!(),
) },
.unwrap(), Ordering::Greater => return None,
_ => unreachable!(), };
},
Ordering::Greater => return None,
};
computed_scalar_int = Some(scalar_int); computed_scalar_int = Some(scalar_int);
} }
Rvalue::Use(operand) => { Rvalue::Use(operand) => {

View File

@ -326,7 +326,7 @@ pub(crate) fn const_val(
let val = match layout.ty.kind() { let val = match layout.ty.kind() {
ty::Uint(UintTy::U128) | ty::Int(IntTy::I128) => { ty::Uint(UintTy::U128) | ty::Int(IntTy::I128) => {
let const_val = const_val.to_bits(layout.size).unwrap(); let const_val = const_val.assert_bits(layout.size);
let lsb = fx.bcx.ins().iconst(types::I64, const_val as u64 as i64); let lsb = fx.bcx.ins().iconst(types::I64, const_val as u64 as i64);
let msb = fx.bcx.ins().iconst(types::I64, (const_val >> 64) as u64 as i64); let msb = fx.bcx.ins().iconst(types::I64, (const_val >> 64) as u64 as i64);
fx.bcx.ins().iconcat(lsb, msb) fx.bcx.ins().iconcat(lsb, msb)
@ -338,7 +338,7 @@ pub(crate) fn const_val(
| ty::Ref(..) | ty::Ref(..)
| ty::RawPtr(..) | ty::RawPtr(..)
| ty::FnPtr(..) => { | ty::FnPtr(..) => {
let raw_val = const_val.size().truncate(const_val.to_bits(layout.size).unwrap()); let raw_val = const_val.size().truncate(const_val.assert_bits(layout.size));
fx.bcx.ins().iconst(clif_ty, raw_val as i64) fx.bcx.ins().iconst(clif_ty, raw_val as i64)
} }
ty::Float(FloatTy::F32) => { ty::Float(FloatTy::F32) => {