From 052cd3bff7c0008cedb153abc38f12b3938c7f0c Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sun, 31 Jan 2021 14:23:49 +0100 Subject: [PATCH] rustup; remove some no-longer-needed Windows shims --- rust-version | 2 +- src/shims/posix/dlsym.rs | 2 ++ src/shims/windows/dlsym.rs | 54 +++--------------------------- src/shims/windows/foreign_items.rs | 6 ---- 4 files changed, 7 insertions(+), 57 deletions(-) diff --git a/rust-version b/rust-version index e9314ffced0..1aa101dca14 100644 --- a/rust-version +++ b/rust-version @@ -1 +1 @@ -9b3242982202707be2485b1e4cf5f3b34466a38d +0e63af5da3400ace48a0345117980473fd21ad73 diff --git a/src/shims/posix/dlsym.rs b/src/shims/posix/dlsym.rs index e05419f47e9..660c6dc0eba 100644 --- a/src/shims/posix/dlsym.rs +++ b/src/shims/posix/dlsym.rs @@ -34,7 +34,9 @@ fn call_dlsym( ret: Option<(PlaceTy<'tcx, Tag>, mir::BasicBlock)>, ) -> InterpResult<'tcx> { let this = self.eval_context_mut(); + check_abi(abi, Abi::C)?; + match dlsym { Dlsym::Linux(dlsym) => linux::EvalContextExt::call_dlsym(this, dlsym, args, ret), Dlsym::MacOs(dlsym) => macos::EvalContextExt::call_dlsym(this, dlsym, args, ret), diff --git a/src/shims/windows/dlsym.rs b/src/shims/windows/dlsym.rs index ce119d1090b..57766bd344a 100644 --- a/src/shims/windows/dlsym.rs +++ b/src/shims/windows/dlsym.rs @@ -1,20 +1,11 @@ use rustc_middle::mir; use rustc_target::spec::abi::Abi; -use log::trace; - use crate::*; -use helpers::{check_abi, check_arg_count}; -use shims::windows::sync::EvalContextExt as _; +use helpers::check_abi; #[derive(Debug, Copy, Clone)] pub enum Dlsym { - AcquireSRWLockExclusive, - ReleaseSRWLockExclusive, - TryAcquireSRWLockExclusive, - AcquireSRWLockShared, - ReleaseSRWLockShared, - TryAcquireSRWLockShared, } impl Dlsym { @@ -22,12 +13,6 @@ impl Dlsym { // should become a NULL pointer (pretend it does not exist). pub fn from_str(name: &str) -> InterpResult<'static, Option> { Ok(match name { - "AcquireSRWLockExclusive" => Some(Dlsym::AcquireSRWLockExclusive), - "ReleaseSRWLockExclusive" => Some(Dlsym::ReleaseSRWLockExclusive), - "TryAcquireSRWLockExclusive" => Some(Dlsym::TryAcquireSRWLockExclusive), - "AcquireSRWLockShared" => Some(Dlsym::AcquireSRWLockShared), - "ReleaseSRWLockShared" => Some(Dlsym::ReleaseSRWLockShared), - "TryAcquireSRWLockShared" => Some(Dlsym::TryAcquireSRWLockShared), "GetSystemTimePreciseAsFileTime" => None, _ => throw_unsup_format!("unsupported Windows dlsym: {}", name), }) @@ -40,46 +25,15 @@ fn call_dlsym( &mut self, dlsym: Dlsym, abi: Abi, - args: &[OpTy<'tcx, Tag>], + _args: &[OpTy<'tcx, Tag>], ret: Option<(PlaceTy<'tcx, Tag>, mir::BasicBlock)>, ) -> InterpResult<'tcx> { let this = self.eval_context_mut(); - let (dest, ret) = ret.expect("we don't support any diverging dlsym"); + let (_dest, _ret) = ret.expect("we don't support any diverging dlsym"); assert!(this.tcx.sess.target.os == "windows"); check_abi(abi, Abi::System)?; - match dlsym { - Dlsym::AcquireSRWLockExclusive => { - let &[ptr] = check_arg_count(args)?; - this.AcquireSRWLockExclusive(ptr)?; - } - Dlsym::ReleaseSRWLockExclusive => { - let &[ptr] = check_arg_count(args)?; - this.ReleaseSRWLockExclusive(ptr)?; - } - Dlsym::TryAcquireSRWLockExclusive => { - let &[ptr] = check_arg_count(args)?; - let ret = this.TryAcquireSRWLockExclusive(ptr)?; - this.write_scalar(Scalar::from_u8(ret), dest)?; - } - Dlsym::AcquireSRWLockShared => { - let &[ptr] = check_arg_count(args)?; - this.AcquireSRWLockShared(ptr)?; - } - Dlsym::ReleaseSRWLockShared => { - let &[ptr] = check_arg_count(args)?; - this.ReleaseSRWLockShared(ptr)?; - } - Dlsym::TryAcquireSRWLockShared => { - let &[ptr] = check_arg_count(args)?; - let ret = this.TryAcquireSRWLockShared(ptr)?; - this.write_scalar(Scalar::from_u8(ret), dest)?; - } - } - - trace!("{:?}", this.dump_place(*dest)); - this.go_to_block(ret); - Ok(()) + match dlsym {} } } diff --git a/src/shims/windows/foreign_items.rs b/src/shims/windows/foreign_items.rs index 52b68b9f1bc..0eeec08901d 100644 --- a/src/shims/windows/foreign_items.rs +++ b/src/shims/windows/foreign_items.rs @@ -300,12 +300,6 @@ fn emulate_foreign_item_by_name( // Just fake a HANDLE this.write_scalar(Scalar::from_machine_isize(1, this), dest)?; } - "GetModuleHandleW" if this.frame().instance.to_string().starts_with("std::sys::windows::") => { - #[allow(non_snake_case)] - let &[_lpModuleName] = check_arg_count(args)?; - // Pretend this does not exist / nothing happened, by returning zero. - this.write_null(dest)?; - } "SetConsoleTextAttribute" if this.frame().instance.to_string().starts_with("std::sys::windows::") => { #[allow(non_snake_case)] let &[_hConsoleOutput, _wAttribute] = check_arg_count(args)?;