Skip to content

Commit b856447

Browse files
committed
update cfgs
1 parent 08a1c93 commit b856447

File tree

7 files changed

+12
-22
lines changed

7 files changed

+12
-22
lines changed

src/alloc_addresses/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,6 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
478478
/// provenances should be exposed. Note that if `prepare_exposed_for_native_call` was not
479479
/// called before the FFI (with `paranoid` set to false) then some of the writes may be
480480
/// lost!
481-
#[cfg(all(unix, any(target_arch = "x86", target_arch = "x86_64")))]
482481
fn apply_events(&mut self, _events: crate::shims::trace::MemEvents) -> InterpResult<'tcx> {
483482
let this = self.eval_context_mut();
484483
let _exposed: Vec<AllocId> =

src/alloc_bytes.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use std::{alloc, slice};
55
use rustc_abi::{Align, Size};
66
use rustc_middle::mir::interpret::AllocBytes;
77

8-
#[cfg(all(unix, any(target_arch = "x86", target_arch = "x86_64")))]
8+
#[cfg(unix)]
99
use crate::discrete_alloc::MachineAlloc;
1010
use crate::helpers::ToU64 as _;
1111

@@ -42,9 +42,9 @@ impl Drop for MiriAllocBytes {
4242

4343
// SAFETY: Invariant, `self.ptr` points to memory allocated with `self.layout`.
4444
unsafe {
45-
#[cfg(all(unix, any(target_arch = "x86", target_arch = "x86_64")))]
45+
#[cfg(unix)]
4646
MachineAlloc::dealloc(self.ptr, alloc_layout);
47-
#[cfg(not(all(unix, any(target_arch = "x86", target_arch = "x86_64"))))]
47+
#[cfg(not(unix))]
4848
alloc::dealloc(self.ptr, alloc_layout);
4949
}
5050
}
@@ -100,11 +100,11 @@ impl AllocBytes for MiriAllocBytes {
100100
let align = align.bytes();
101101
// SAFETY: `alloc_fn` will only be used with `size != 0`.
102102
let alloc_fn = |layout| unsafe {
103-
#[cfg(all(unix, any(target_arch = "x86", target_arch = "x86_64")))]
103+
#[cfg(unix)]
104104
{
105105
MachineAlloc::alloc(layout)
106106
}
107-
#[cfg(not(all(unix, any(target_arch = "x86", target_arch = "x86_64"))))]
107+
#[cfg(not(unix))]
108108
{
109109
alloc::alloc(layout)
110110
}
@@ -124,11 +124,11 @@ impl AllocBytes for MiriAllocBytes {
124124
let align = align.bytes();
125125
// SAFETY: `alloc_fn` will only be used with `size != 0`.
126126
let alloc_fn = |layout| unsafe {
127-
#[cfg(all(unix, any(target_arch = "x86", target_arch = "x86_64")))]
127+
#[cfg(unix)]
128128
{
129129
MachineAlloc::alloc_zeroed(layout)
130130
}
131-
#[cfg(not(all(unix, any(target_arch = "x86", target_arch = "x86_64"))))]
131+
#[cfg(not(unix))]
132132
{
133133
alloc::alloc_zeroed(layout)
134134
}

src/bin/miri.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,9 @@ fn entry_fn(tcx: TyCtxt<'_>) -> (DefId, MiriEntryFnType) {
132132

133133
/// If for whatever reason the supervisor process exists but can't see that
134134
/// we died, inform it manually.
135+
#[inline]
135136
fn exit(return_code: i32) -> ! {
137+
#[cfg(unix)]
136138
miri::kill_sv(return_code);
137139
std::process::exit(return_code)
138140
}

src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ mod borrow_tracker;
7676
mod clock;
7777
mod concurrency;
7878
mod diagnostics;
79-
#[cfg(all(unix, any(target_arch = "x86", target_arch = "x86_64")))]
79+
#[cfg(unix)]
8080
mod discrete_alloc;
8181
mod eval;
8282
mod helpers;
@@ -100,6 +100,7 @@ use rustc_middle::{bug, span_bug};
100100
use tracing::{info, trace};
101101

102102
// Let bin/miri.rs kill the supervisor process.
103+
#[cfg(unix)]
103104
pub use crate::shims::trace::kill_sv;
104105

105106
// Type aliases that set the provenance parameter.

src/machine.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,6 @@ impl<'tcx> MiriMachine<'tcx> {
739739
// undefined behaviour in Miri itself!
740740
(
741741
unsafe {
742-
#[cfg(all(unix, any(target_arch = "x86", target_arch = "x86_64")))]
743742
discrete_alloc::MachineAlloc::enable();
744743
libloading::Library::new(lib_file_path)
745744
.expect("failed to read specified extern shared object file")

src/shims/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pub mod os_str;
1919
pub mod panic;
2020
pub mod time;
2121
pub mod tls;
22-
#[cfg(all(unix, any(target_arch = "x86", target_arch = "x86_64")))]
22+
#[cfg(unix)]
2323
pub mod trace;
2424

2525
pub use self::files::FdTable;

src/shims/native_lib.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -181,16 +181,13 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
181181
}
182182

183183
// Prepare all exposed memory, depending on whether we have a supervisor process.
184-
#[cfg(all(unix, any(target_arch = "x86", target_arch = "x86_64")))]
185184
if super::trace::Supervisor::init().is_ok() {
186185
this.prepare_exposed_for_native_call(false)?;
187186
} else {
188187
//this.prepare_exposed_for_native_call(true)?;
189188
//eprintln!("Oh noes!")
190189
panic!("No ptrace!");
191190
}
192-
#[cfg(not(all(unix, any(target_arch = "x86", target_arch = "x86_64"))))]
193-
this.prepare_exposed_for_native_call(true)?;
194191

195192
// Convert them to `libffi::high::Arg` type.
196193
let libffi_args = libffi_args
@@ -200,7 +197,6 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
200197

201198
// Call the function and store output, depending on return type in the function signature.
202199
let ret = this.call_native_with_args(link_name, dest, code_ptr, libffi_args)?;
203-
#[cfg(all(unix, any(target_arch = "x86", target_arch = "x86_64")))]
204200
if let Some(events) = super::trace::Supervisor::get_events() {
205201
this.apply_events(events)?;
206202
}
@@ -209,7 +205,6 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
209205
}
210206
}
211207

212-
#[cfg(all(unix, any(target_arch = "x86", target_arch = "x86_64")))]
213208
unsafe fn do_native_call<T: libffi::high::CType>(ptr: CodePtr, args: &[ffi::Arg<'_>]) -> T {
214209
use shims::trace::Supervisor;
215210

@@ -221,12 +216,6 @@ unsafe fn do_native_call<T: libffi::high::CType>(ptr: CodePtr, args: &[ffi::Arg<
221216
}
222217
}
223218

224-
#[cfg(not(all(unix, any(target_arch = "x86", target_arch = "x86_64"))))]
225-
#[inline(always)]
226-
unsafe fn do_native_call<T: libffi::high::CType>(ptr: CodePtr, args: &[ffi::Arg<'_>]) -> T {
227-
unsafe { ffi::call(ptr, args) }
228-
}
229-
230219
#[derive(Debug, Clone)]
231220
/// Enum of supported arguments to external C functions.
232221
// We introduce this enum instead of just calling `ffi::arg` and storing a list

0 commit comments

Comments
 (0)