@@ -92,8 +92,7 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> {
92
92
fn get_func_ptr_explicitly_from_lib ( & mut self , link_name : Symbol ) -> Option < CodePtr > {
93
93
let this = self . eval_context_mut ( ) ;
94
94
// Try getting the function from the shared library.
95
- // On windows `_lib_path` will be unused, hence the name starting with `_`.
96
- let ( lib, _lib_path) = this. machine . native_lib . as_ref ( ) . unwrap ( ) ;
95
+ let ( lib, lib_path) = this. machine . native_lib . as_ref ( ) . unwrap ( ) ;
97
96
let func: libloading:: Symbol < ' _ , unsafe extern "C" fn ( ) > = unsafe {
98
97
match lib. get ( link_name. as_str ( ) . as_bytes ( ) ) {
99
98
Ok ( x) => x,
@@ -114,16 +113,17 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> {
114
113
// This code is a reimplementation of the mechanism for getting `dli_fname` in `libloading`,
115
114
// from: https://docs.rs/libloading/0.7.3/src/libloading/os/unix/mod.rs.html#411
116
115
// using the `libc` crate where this interface is public.
117
- let mut info = std:: mem:: MaybeUninit :: < libc:: Dl_info > :: uninit ( ) ;
116
+ let mut info = std:: mem:: MaybeUninit :: < libc:: Dl_info > :: zeroed ( ) ;
118
117
unsafe {
119
118
if libc:: dladdr ( * func. deref ( ) as * const _ , info. as_mut_ptr ( ) ) != 0 {
120
119
let info = info. assume_init ( ) ;
121
120
#[ cfg( target_os = "cygwin" ) ]
122
121
let fname_ptr = info. dli_fname . as_ptr ( ) ;
123
122
#[ cfg( not( target_os = "cygwin" ) ) ]
124
123
let fname_ptr = info. dli_fname ;
124
+ assert ! ( !fname_ptr. is_null( ) ) ;
125
125
if std:: ffi:: CStr :: from_ptr ( fname_ptr) . to_str ( ) . unwrap ( )
126
- != _lib_path . to_str ( ) . unwrap ( )
126
+ != lib_path . to_str ( ) . unwrap ( )
127
127
{
128
128
return None ;
129
129
}
0 commit comments