1
1
//! Implements calling functions from a native library.
2
2
3
- #[ cfg( target_os = "linux" ) ]
4
- pub mod trace;
3
+ // FIXME: disabled since it fails to build on many targets.
4
+ //#[cfg(target_os = "linux")]
5
+ //pub mod trace;
5
6
6
7
use std:: ops:: Deref ;
7
8
@@ -12,13 +13,13 @@ use rustc_middle::mir::interpret::Pointer;
12
13
use rustc_middle:: ty:: { self as ty, IntTy , UintTy } ;
13
14
use rustc_span:: Symbol ;
14
15
15
- #[ cfg( target_os = "linux" ) ]
16
- use self :: trace:: Supervisor ;
16
+ // #[cfg(target_os = "linux")]
17
+ // use self::trace::Supervisor;
17
18
use crate :: * ;
18
19
19
- #[ cfg( target_os = "linux" ) ]
20
- type CallResult < ' tcx > = InterpResult < ' tcx , ( ImmTy < ' tcx > , Option < self :: trace:: messages:: MemEvents > ) > ;
21
- #[ cfg( not( target_os = "linux" ) ) ]
20
+ // #[cfg(target_os = "linux")]
21
+ // type CallResult<'tcx> = InterpResult<'tcx, (ImmTy<'tcx>, Option<self::trace::messages::MemEvents>)>;
22
+ // #[cfg(not(target_os = "linux"))]
22
23
type CallResult < ' tcx > = InterpResult < ' tcx , ( ImmTy < ' tcx > , Option < !> ) > ;
23
24
24
25
impl < ' tcx > EvalContextExtPriv < ' tcx > for crate :: MiriInterpCx < ' tcx > { }
@@ -32,12 +33,12 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> {
32
33
libffi_args : Vec < libffi:: high:: Arg < ' a > > ,
33
34
) -> CallResult < ' tcx > {
34
35
let this = self . eval_context_mut ( ) ;
35
- #[ cfg( target_os = "linux" ) ]
36
- let alloc = this. machine . allocator . as_ref ( ) . unwrap ( ) ;
36
+ // #[cfg(target_os = "linux")]
37
+ // let alloc = this.machine.allocator.as_ref().unwrap();
37
38
38
39
// SAFETY: We don't touch the machine memory past this point.
39
- #[ cfg( target_os = "linux" ) ]
40
- let ( guard, stack_ptr) = unsafe { Supervisor :: start_ffi ( alloc) } ;
40
+ // #[cfg(target_os = "linux")]
41
+ // let (guard, stack_ptr) = unsafe { Supervisor::start_ffi(alloc) };
41
42
42
43
// Call the function (`ptr`) with arguments `libffi_args`, and obtain the return value
43
44
// as the specified primitive integer type
@@ -111,9 +112,9 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> {
111
112
112
113
// SAFETY: We got the guard and stack pointer from start_ffi, and
113
114
// the allocator is the same
114
- #[ cfg( target_os = "linux" ) ]
115
- let events = unsafe { Supervisor :: end_ffi ( alloc, guard, stack_ptr) } ;
116
- #[ cfg( not( target_os = "linux" ) ) ]
115
+ // #[cfg(target_os = "linux")]
116
+ // let events = unsafe { Supervisor::end_ffi(alloc, guard, stack_ptr) };
117
+ // #[cfg(not(target_os = "linux"))]
117
118
let events = None ;
118
119
119
120
interp_ok ( ( res?, events) )
@@ -213,9 +214,9 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
213
214
if !this. machine . native_call_mem_warned . replace ( true ) {
214
215
// Newly set, so first time we get here.
215
216
this. emit_diagnostic ( NonHaltingDiagnostic :: NativeCallSharedMem {
216
- #[ cfg( target_os = "linux" ) ]
217
- tracing : self :: trace:: Supervisor :: is_enabled ( ) ,
218
- #[ cfg( not( target_os = "linux" ) ) ]
217
+ // #[cfg(target_os = "linux")]
218
+ // tracing: self::trace::Supervisor::is_enabled(),
219
+ // #[cfg(not(target_os = "linux"))]
219
220
tracing : false ,
220
221
} ) ;
221
222
}
0 commit comments