@@ -114,18 +114,19 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> {
114
114
// using the `libc` crate where this interface is public.
115
115
let mut info = std:: mem:: MaybeUninit :: < libc:: Dl_info > :: zeroed ( ) ;
116
116
unsafe {
117
- if libc:: dladdr ( fn_ptr, info. as_mut_ptr ( ) ) != 0 {
118
- let info = info. assume_init ( ) ;
119
- #[ cfg( target_os = "cygwin" ) ]
120
- let fname_ptr = info. dli_fname . as_ptr ( ) ;
121
- #[ cfg( not( target_os = "cygwin" ) ) ]
122
- let fname_ptr = info. dli_fname ;
123
- assert ! ( !fname_ptr. is_null( ) ) ;
124
- if std:: ffi:: CStr :: from_ptr ( fname_ptr) . to_str ( ) . unwrap ( )
125
- != lib_path. to_str ( ) . unwrap ( )
126
- {
127
- return None ;
128
- }
117
+ let res = libc:: dladdr ( fn_ptr, info. as_mut_ptr ( ) ) ;
118
+ assert ! ( res != 0 , "failed to load info about function we already loaded" ) ;
119
+ let info = info. assume_init ( ) ;
120
+ #[ cfg( target_os = "cygwin" ) ]
121
+ let fname_ptr = info. dli_fname . as_ptr ( ) ;
122
+ #[ cfg( not( target_os = "cygwin" ) ) ]
123
+ let fname_ptr = info. dli_fname ;
124
+ assert ! ( !fname_ptr. is_null( ) ) ;
125
+ if std:: ffi:: CStr :: from_ptr ( fname_ptr) . to_str ( ) . unwrap ( )
126
+ != lib_path. to_str ( ) . unwrap ( )
127
+ {
128
+ // The function is not actually in this .so, check the next one.
129
+ continue ;
129
130
}
130
131
}
131
132
0 commit comments