Skip to content

Commit ae13c9a

Browse files
committed
update cfgs
1 parent 08a1c93 commit ae13c9a

File tree

7 files changed

+19
-16
lines changed

7 files changed

+19
-16
lines changed

src/alloc_addresses/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ 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")))]
481+
#[cfg(target_os = "linux")]
482482
fn apply_events(&mut self, _events: crate::shims::trace::MemEvents) -> InterpResult<'tcx> {
483483
let this = self.eval_context_mut();
484484
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(target_os = "linux")]
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(target_os = "linux")]
4646
MachineAlloc::dealloc(self.ptr, alloc_layout);
47-
#[cfg(not(all(unix, any(target_arch = "x86", target_arch = "x86_64"))))]
47+
#[cfg(not(target_os = "linux"))]
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(target_os = "linux")]
104104
{
105105
MachineAlloc::alloc(layout)
106106
}
107-
#[cfg(not(all(unix, any(target_arch = "x86", target_arch = "x86_64"))))]
107+
#[cfg(not(target_os = "linux"))]
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(target_os = "linux")]
128128
{
129129
MachineAlloc::alloc_zeroed(layout)
130130
}
131-
#[cfg(not(all(unix, any(target_arch = "x86", target_arch = "x86_64"))))]
131+
#[cfg(not(target_os = "linux"))]
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(target_os = "linux")]
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(target_os = "linux")]
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(target_os = "linux")]
103104
pub use crate::shims::trace::kill_sv;
104105

105106
// Type aliases that set the provenance parameter.

src/machine.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,7 @@ 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")))]
742+
#[cfg(target_os = "linux")]
743743
discrete_alloc::MachineAlloc::enable();
744744
libloading::Library::new(lib_file_path)
745745
.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(target_os = "linux")]
2323
pub mod trace;
2424

2525
pub use self::files::FdTable;

src/shims/native_lib.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,15 +181,15 @@ 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")))]
184+
#[cfg(target_os = "linux")]
185185
if super::trace::Supervisor::init().is_ok() {
186186
this.prepare_exposed_for_native_call(false)?;
187187
} else {
188188
//this.prepare_exposed_for_native_call(true)?;
189189
//eprintln!("Oh noes!")
190190
panic!("No ptrace!");
191191
}
192-
#[cfg(not(all(unix, any(target_arch = "x86", target_arch = "x86_64"))))]
192+
#[cfg(not(target_os = "linux"))]
193193
this.prepare_exposed_for_native_call(true)?;
194194

195195
// Convert them to `libffi::high::Arg` type.
@@ -200,7 +200,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
200200

201201
// Call the function and store output, depending on return type in the function signature.
202202
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")))]
203+
#[cfg(target_os = "linux")]
204204
if let Some(events) = super::trace::Supervisor::get_events() {
205205
this.apply_events(events)?;
206206
}
@@ -209,7 +209,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
209209
}
210210
}
211211

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

@@ -221,7 +221,7 @@ unsafe fn do_native_call<T: libffi::high::CType>(ptr: CodePtr, args: &[ffi::Arg<
221221
}
222222
}
223223

224-
#[cfg(not(all(unix, any(target_arch = "x86", target_arch = "x86_64"))))]
224+
#[cfg(not(target_os = "linux"))]
225225
#[inline(always)]
226226
unsafe fn do_native_call<T: libffi::high::CType>(ptr: CodePtr, args: &[ffi::Arg<'_>]) -> T {
227227
unsafe { ffi::call(ptr, args) }

0 commit comments

Comments
 (0)