Skip to content

Commit de0800e

Browse files
committed
Auto merge of #1688 - RalfJung:rustup, r=RalfJung
adjust Windows shims for stdlib changes (Windows XP removal)
2 parents 5483ed5 + 13dd513 commit de0800e

File tree

3 files changed

+36
-2
lines changed

3 files changed

+36
-2
lines changed

rust-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
dc1eee2f256efbd1d3b50b6b090232f81cac6d72
1+
9a9477fada5baf69d693e717d6df902e411a73d6

src/shims/windows/dlsym.rs

-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ impl Dlsym {
2727
"AcquireSRWLockShared" => Some(Dlsym::AcquireSRWLockShared),
2828
"ReleaseSRWLockShared" => Some(Dlsym::ReleaseSRWLockShared),
2929
"TryAcquireSRWLockShared" => Some(Dlsym::TryAcquireSRWLockShared),
30-
"SetThreadStackGuarantee" => None,
3130
"GetSystemTimePreciseAsFileTime" => None,
3231
_ => throw_unsup_format!("unsupported Windows dlsym: {}", name),
3332
})

src/shims/windows/foreign_items.rs

+35
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use rustc_target::abi::Size;
55

66
use crate::*;
77
use helpers::check_arg_count;
8+
use shims::windows::sync::EvalContextExt as _;
89

910
impl<'mir, 'tcx: 'mir> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {}
1011
pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx> {
@@ -207,6 +208,34 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
207208
this.write_scalar(Scalar::from_i32(result), dest)?;
208209
}
209210

211+
// Synchronization primitives
212+
"AcquireSRWLockExclusive" => {
213+
let &[ptr] = check_arg_count(args)?;
214+
this.AcquireSRWLockExclusive(ptr)?;
215+
}
216+
"ReleaseSRWLockExclusive" => {
217+
let &[ptr] = check_arg_count(args)?;
218+
this.ReleaseSRWLockExclusive(ptr)?;
219+
}
220+
"TryAcquireSRWLockExclusive" => {
221+
let &[ptr] = check_arg_count(args)?;
222+
let ret = this.TryAcquireSRWLockExclusive(ptr)?;
223+
this.write_scalar(Scalar::from_u8(ret), dest)?;
224+
}
225+
"AcquireSRWLockShared" => {
226+
let &[ptr] = check_arg_count(args)?;
227+
this.AcquireSRWLockShared(ptr)?;
228+
}
229+
"ReleaseSRWLockShared" => {
230+
let &[ptr] = check_arg_count(args)?;
231+
this.ReleaseSRWLockShared(ptr)?;
232+
}
233+
"TryAcquireSRWLockShared" => {
234+
let &[ptr] = check_arg_count(args)?;
235+
let ret = this.TryAcquireSRWLockShared(ptr)?;
236+
this.write_scalar(Scalar::from_u8(ret), dest)?;
237+
}
238+
210239
// Dynamic symbol loading
211240
"GetProcAddress" => {
212241
#[allow(non_snake_case)]
@@ -285,6 +314,12 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
285314
// Any non zero value works for the stdlib. This is just used for stack overflows anyway.
286315
this.write_scalar(Scalar::from_machine_usize(1, this), dest)?;
287316
}
317+
"SetThreadStackGuarantee" if this.frame().instance.to_string().starts_with("std::sys::windows::") => {
318+
#[allow(non_snake_case)]
319+
let &[_StackSizeInBytes] = check_arg_count(args)?;
320+
// Any non zero value works for the stdlib. This is just used for stack overflows anyway.
321+
this.write_scalar(Scalar::from_u32(1), dest)?;
322+
}
288323
| "InitializeCriticalSection"
289324
| "EnterCriticalSection"
290325
| "LeaveCriticalSection"

0 commit comments

Comments
 (0)