Skip to content

Commit 052cd3b

Browse files
committed
rustup; remove some no-longer-needed Windows shims
1 parent 8d24b02 commit 052cd3b

File tree

4 files changed

+7
-57
lines changed

4 files changed

+7
-57
lines changed

rust-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
9b3242982202707be2485b1e4cf5f3b34466a38d
1+
0e63af5da3400ace48a0345117980473fd21ad73

src/shims/posix/dlsym.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
3434
ret: Option<(PlaceTy<'tcx, Tag>, mir::BasicBlock)>,
3535
) -> InterpResult<'tcx> {
3636
let this = self.eval_context_mut();
37+
3738
check_abi(abi, Abi::C)?;
39+
3840
match dlsym {
3941
Dlsym::Linux(dlsym) => linux::EvalContextExt::call_dlsym(this, dlsym, args, ret),
4042
Dlsym::MacOs(dlsym) => macos::EvalContextExt::call_dlsym(this, dlsym, args, ret),

src/shims/windows/dlsym.rs

Lines changed: 4 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,18 @@
11
use rustc_middle::mir;
22
use rustc_target::spec::abi::Abi;
33

4-
use log::trace;
5-
64
use crate::*;
7-
use helpers::{check_abi, check_arg_count};
8-
use shims::windows::sync::EvalContextExt as _;
5+
use helpers::check_abi;
96

107
#[derive(Debug, Copy, Clone)]
118
pub enum Dlsym {
12-
AcquireSRWLockExclusive,
13-
ReleaseSRWLockExclusive,
14-
TryAcquireSRWLockExclusive,
15-
AcquireSRWLockShared,
16-
ReleaseSRWLockShared,
17-
TryAcquireSRWLockShared,
189
}
1910

2011
impl Dlsym {
2112
// Returns an error for unsupported symbols, and None if this symbol
2213
// should become a NULL pointer (pretend it does not exist).
2314
pub fn from_str(name: &str) -> InterpResult<'static, Option<Dlsym>> {
2415
Ok(match name {
25-
"AcquireSRWLockExclusive" => Some(Dlsym::AcquireSRWLockExclusive),
26-
"ReleaseSRWLockExclusive" => Some(Dlsym::ReleaseSRWLockExclusive),
27-
"TryAcquireSRWLockExclusive" => Some(Dlsym::TryAcquireSRWLockExclusive),
28-
"AcquireSRWLockShared" => Some(Dlsym::AcquireSRWLockShared),
29-
"ReleaseSRWLockShared" => Some(Dlsym::ReleaseSRWLockShared),
30-
"TryAcquireSRWLockShared" => Some(Dlsym::TryAcquireSRWLockShared),
3116
"GetSystemTimePreciseAsFileTime" => None,
3217
_ => throw_unsup_format!("unsupported Windows dlsym: {}", name),
3318
})
@@ -40,46 +25,15 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
4025
&mut self,
4126
dlsym: Dlsym,
4227
abi: Abi,
43-
args: &[OpTy<'tcx, Tag>],
28+
_args: &[OpTy<'tcx, Tag>],
4429
ret: Option<(PlaceTy<'tcx, Tag>, mir::BasicBlock)>,
4530
) -> InterpResult<'tcx> {
4631
let this = self.eval_context_mut();
47-
let (dest, ret) = ret.expect("we don't support any diverging dlsym");
32+
let (_dest, _ret) = ret.expect("we don't support any diverging dlsym");
4833
assert!(this.tcx.sess.target.os == "windows");
4934

5035
check_abi(abi, Abi::System)?;
5136

52-
match dlsym {
53-
Dlsym::AcquireSRWLockExclusive => {
54-
let &[ptr] = check_arg_count(args)?;
55-
this.AcquireSRWLockExclusive(ptr)?;
56-
}
57-
Dlsym::ReleaseSRWLockExclusive => {
58-
let &[ptr] = check_arg_count(args)?;
59-
this.ReleaseSRWLockExclusive(ptr)?;
60-
}
61-
Dlsym::TryAcquireSRWLockExclusive => {
62-
let &[ptr] = check_arg_count(args)?;
63-
let ret = this.TryAcquireSRWLockExclusive(ptr)?;
64-
this.write_scalar(Scalar::from_u8(ret), dest)?;
65-
}
66-
Dlsym::AcquireSRWLockShared => {
67-
let &[ptr] = check_arg_count(args)?;
68-
this.AcquireSRWLockShared(ptr)?;
69-
}
70-
Dlsym::ReleaseSRWLockShared => {
71-
let &[ptr] = check_arg_count(args)?;
72-
this.ReleaseSRWLockShared(ptr)?;
73-
}
74-
Dlsym::TryAcquireSRWLockShared => {
75-
let &[ptr] = check_arg_count(args)?;
76-
let ret = this.TryAcquireSRWLockShared(ptr)?;
77-
this.write_scalar(Scalar::from_u8(ret), dest)?;
78-
}
79-
}
80-
81-
trace!("{:?}", this.dump_place(*dest));
82-
this.go_to_block(ret);
83-
Ok(())
37+
match dlsym {}
8438
}
8539
}

src/shims/windows/foreign_items.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -300,12 +300,6 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
300300
// Just fake a HANDLE
301301
this.write_scalar(Scalar::from_machine_isize(1, this), dest)?;
302302
}
303-
"GetModuleHandleW" if this.frame().instance.to_string().starts_with("std::sys::windows::") => {
304-
#[allow(non_snake_case)]
305-
let &[_lpModuleName] = check_arg_count(args)?;
306-
// Pretend this does not exist / nothing happened, by returning zero.
307-
this.write_null(dest)?;
308-
}
309303
"SetConsoleTextAttribute" if this.frame().instance.to_string().starts_with("std::sys::windows::") => {
310304
#[allow(non_snake_case)]
311305
let &[_hConsoleOutput, _wAttribute] = check_arg_count(args)?;

0 commit comments

Comments
 (0)