Skip to content

Commit 12c8fb8

Browse files
committed
Fix fname for miri
1 parent 5e048e0 commit 12c8fb8

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/tools/miri/src/shims/native_lib.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,12 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> {
117117
let mut info = std::mem::MaybeUninit::<libc::Dl_info>::uninit();
118118
unsafe {
119119
if libc::dladdr(*func.deref() as *const _, info.as_mut_ptr()) != 0 {
120-
if std::ffi::CStr::from_ptr(info.assume_init().dli_fname).to_str().unwrap()
120+
let info = info.assume_init();
121+
#[cfg(target_os = "cygwin")]
122+
let fname_ptr = info.dli_fname.as_ptr();
123+
#[cfg(not(target_os = "cygwin"))]
124+
let fname_ptr = info.dli_fname;
125+
if std::ffi::CStr::from_ptr(fname_ptr).to_str().unwrap()
121126
!= _lib_path.to_str().unwrap()
122127
{
123128
return None;

0 commit comments

Comments
 (0)