Fix pending reviews
This commit is contained in:
parent
9130034337
commit
97a512070a
@ -2,15 +2,15 @@ use rustc_middle::mir;
|
|||||||
use rustc_target::spec::abi::Abi;
|
use rustc_target::spec::abi::Abi;
|
||||||
|
|
||||||
use crate::*;
|
use crate::*;
|
||||||
|
use shims::unix::freebsd::dlsym as freebsd;
|
||||||
use shims::unix::linux::dlsym as linux;
|
use shims::unix::linux::dlsym as linux;
|
||||||
use shims::unix::macos::dlsym as macos;
|
use shims::unix::macos::dlsym as macos;
|
||||||
use shims::unix::freebsd::dlsym as freebsd;
|
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone)]
|
#[derive(Debug, Copy, Clone)]
|
||||||
pub enum Dlsym {
|
pub enum Dlsym {
|
||||||
Linux(linux::Dlsym),
|
Linux(linux::Dlsym),
|
||||||
MacOs(macos::Dlsym),
|
MacOs(macos::Dlsym),
|
||||||
FreeBSD(freebsd::Dlsym)
|
FreeBSD(freebsd::Dlsym),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Dlsym {
|
impl Dlsym {
|
||||||
@ -43,7 +43,8 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
|
|||||||
match dlsym {
|
match dlsym {
|
||||||
Dlsym::Linux(dlsym) => linux::EvalContextExt::call_dlsym(this, dlsym, args, dest, ret),
|
Dlsym::Linux(dlsym) => linux::EvalContextExt::call_dlsym(this, dlsym, args, dest, ret),
|
||||||
Dlsym::MacOs(dlsym) => macos::EvalContextExt::call_dlsym(this, dlsym, args, dest, ret),
|
Dlsym::MacOs(dlsym) => macos::EvalContextExt::call_dlsym(this, dlsym, args, dest, ret),
|
||||||
Dlsym::FreeBSD(dlsym) => freebsd::EvalContextExt::call_dlsym(this, dlsym, args, dest, ret)
|
Dlsym::FreeBSD(dlsym) =>
|
||||||
|
freebsd::EvalContextExt::call_dlsym(this, dlsym, args, dest, ret),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,10 @@
|
|||||||
use rustc_middle::mir;
|
use rustc_middle::mir;
|
||||||
|
|
||||||
use crate::*;
|
use crate::*;
|
||||||
use helpers::check_arg_count;
|
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone)]
|
#[derive(Debug, Copy, Clone)]
|
||||||
#[allow(non_camel_case_types)]
|
#[allow(non_camel_case_types)]
|
||||||
pub enum Dlsym {
|
pub enum Dlsym {}
|
||||||
getentropy,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Dlsym {
|
impl Dlsym {
|
||||||
// Returns an error for unsupported symbols, and None if this symbol
|
// Returns an error for unsupported symbols, and None if this symbol
|
||||||
|
@ -20,4 +20,4 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
|
|||||||
// match
|
// match
|
||||||
Ok(EmulateByNameResult::NeedsJumping)
|
Ok(EmulateByNameResult::NeedsJumping)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
|
pub mod dlsym;
|
||||||
pub mod foreign_items;
|
pub mod foreign_items;
|
||||||
pub mod dlsym;
|
|
@ -3,10 +3,12 @@ use rustc_middle::mir;
|
|||||||
use log::trace;
|
use log::trace;
|
||||||
|
|
||||||
use crate::*;
|
use crate::*;
|
||||||
|
use helpers::check_arg_count;
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone)]
|
#[derive(Debug, Copy, Clone)]
|
||||||
#[allow(non_camel_case_types)]
|
#[allow(non_camel_case_types)]
|
||||||
pub enum Dlsym {
|
pub enum Dlsym {
|
||||||
|
getentropy,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Dlsym {
|
impl Dlsym {
|
||||||
@ -14,7 +16,8 @@ impl Dlsym {
|
|||||||
// should become a NULL pointer (pretend it does not exist).
|
// should become a NULL pointer (pretend it does not exist).
|
||||||
pub fn from_str<'tcx>(name: &str) -> InterpResult<'tcx, Option<Dlsym>> {
|
pub fn from_str<'tcx>(name: &str) -> InterpResult<'tcx, Option<Dlsym>> {
|
||||||
Ok(match name {
|
Ok(match name {
|
||||||
_ => throw_unsup_format!("unsupported freebsd dlsym: {}", name),
|
"getentropy" => Some(Dlsym::getentropy),
|
||||||
|
_ => throw_unsup_format!("unsupported macOS dlsym: {}", name),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -30,7 +33,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
|
|||||||
) -> InterpResult<'tcx> {
|
) -> InterpResult<'tcx> {
|
||||||
let this = self.eval_context_mut();
|
let this = self.eval_context_mut();
|
||||||
let ret = ret.expect("we don't support any diverging dlsym");
|
let ret = ret.expect("we don't support any diverging dlsym");
|
||||||
assert!(this.tcx.sess.target.os == "freebsd");
|
assert!(this.tcx.sess.target.os == "macos");
|
||||||
|
|
||||||
match dlsym {
|
match dlsym {
|
||||||
Dlsym::getentropy => {
|
Dlsym::getentropy => {
|
||||||
|
@ -5,8 +5,8 @@ mod fs;
|
|||||||
mod sync;
|
mod sync;
|
||||||
mod thread;
|
mod thread;
|
||||||
|
|
||||||
|
mod freebsd;
|
||||||
mod linux;
|
mod linux;
|
||||||
mod macos;
|
mod macos;
|
||||||
mod freebsd;
|
|
||||||
|
|
||||||
pub use fs::{DirHandler, FileHandler};
|
pub use fs::{DirHandler, FileHandler};
|
||||||
|
@ -5,14 +5,14 @@
|
|||||||
|
|
||||||
extern crate libc;
|
extern crate libc;
|
||||||
|
|
||||||
#[cfg(target_os = "linux, freebsd")]
|
#[cfg(any(target_os = "linux", target_os = "freebsd"))]
|
||||||
fn tmp() -> std::path::PathBuf {
|
fn tmp() -> std::path::PathBuf {
|
||||||
std::env::var("MIRI_TEMP")
|
std::env::var("MIRI_TEMP")
|
||||||
.map(std::path::PathBuf::from)
|
.map(std::path::PathBuf::from)
|
||||||
.unwrap_or_else(|_| std::env::temp_dir())
|
.unwrap_or_else(|_| std::env::temp_dir())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(target_os = "linux, freebsd")]
|
#[cfg(any(target_os = "linux", target_os = "freebsd"))]
|
||||||
fn test_posix_fadvise() {
|
fn test_posix_fadvise() {
|
||||||
use std::convert::TryInto;
|
use std::convert::TryInto;
|
||||||
use std::fs::{remove_file, File};
|
use std::fs::{remove_file, File};
|
||||||
@ -42,7 +42,7 @@ fn test_posix_fadvise() {
|
|||||||
assert_eq!(result, 0);
|
assert_eq!(result, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(target_os = "linux, freebsd")]
|
#[cfg(any(target_os = "linux", target_os = "freebsd"))]
|
||||||
fn test_sync_file_range() {
|
fn test_sync_file_range() {
|
||||||
use std::fs::{remove_file, File};
|
use std::fs::{remove_file, File};
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
@ -208,7 +208,7 @@ fn test_rwlock_libc_static_initializer() {
|
|||||||
/// Test whether the `prctl` shim correctly sets the thread name.
|
/// Test whether the `prctl` shim correctly sets the thread name.
|
||||||
///
|
///
|
||||||
/// Note: `prctl` exists only on Linux.
|
/// Note: `prctl` exists only on Linux.
|
||||||
#[cfg(target_os = "linux,freebsd")]
|
#[cfg(any(target_os = "linux", target_os = "freebsd"))]
|
||||||
fn test_prctl_thread_name() {
|
fn test_prctl_thread_name() {
|
||||||
use libc::c_long;
|
use libc::c_long;
|
||||||
use std::ffi::CString;
|
use std::ffi::CString;
|
||||||
@ -277,7 +277,7 @@ fn test_thread_local_errno() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Tests whether clock support exists at all
|
/// Tests whether clock support exists at all
|
||||||
#[cfg(target_os = "linux,freebsd")]
|
#[cfg(any(target_os = "linux", target_os = "freebsd"))]
|
||||||
fn test_clocks() {
|
fn test_clocks() {
|
||||||
let mut tp = std::mem::MaybeUninit::<libc::timespec>::uninit();
|
let mut tp = std::mem::MaybeUninit::<libc::timespec>::uninit();
|
||||||
let is_error = unsafe { libc::clock_gettime(libc::CLOCK_REALTIME, tp.as_mut_ptr()) };
|
let is_error = unsafe { libc::clock_gettime(libc::CLOCK_REALTIME, tp.as_mut_ptr()) };
|
||||||
@ -291,10 +291,10 @@ fn test_clocks() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
#[cfg(target_os = "linux,freebsd")]
|
#[cfg(any(target_os = "linux", target_os = "freebsd"))]
|
||||||
test_posix_fadvise();
|
test_posix_fadvise();
|
||||||
|
|
||||||
#[cfg(target_os = "linux,freebsd")]
|
#[cfg(any(target_os = "linux", target_os = "freebsd"))]
|
||||||
test_sync_file_range();
|
test_sync_file_range();
|
||||||
|
|
||||||
test_mutex_libc_init_recursive();
|
test_mutex_libc_init_recursive();
|
||||||
@ -302,14 +302,14 @@ fn main() {
|
|||||||
test_mutex_libc_init_errorcheck();
|
test_mutex_libc_init_errorcheck();
|
||||||
test_rwlock_libc_static_initializer();
|
test_rwlock_libc_static_initializer();
|
||||||
|
|
||||||
#[cfg(target_os = "linux,freebsd")]
|
#[cfg(any(target_os = "linux", target_os = "freebsd"))]
|
||||||
test_mutex_libc_static_initializer_recursive();
|
test_mutex_libc_static_initializer_recursive();
|
||||||
|
|
||||||
#[cfg(target_os = "linux,freebsd")]
|
#[cfg(any(target_os = "linux", target_os = "freebsd"))]
|
||||||
test_prctl_thread_name();
|
test_prctl_thread_name();
|
||||||
|
|
||||||
test_thread_local_errno();
|
test_thread_local_errno();
|
||||||
|
|
||||||
#[cfg(target_os = "linux,freebsd")]
|
#[cfg(any(target_os = "linux", target_os = "freebsd"))]
|
||||||
test_clocks();
|
test_clocks();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user