From: Rémi Bernon rbernon@codeweavers.com
This makes it possible to detect modules that weren't unmapped from dlclose, and that we should not fixup again.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49640 --- dlls/ntdll/unix/loader.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index 3bb7f056b2a..cd2019be582 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -1274,9 +1274,11 @@ static NTSTATUS dlopen_dll( const char *so_name, UNICODE_STRING *nt_name, void * { void *module, *handle; const IMAGE_NT_HEADERS *nt; + BOOL mapped = FALSE;
callback_module = (void *)1; - handle = dlopen( so_name, RTLD_NOW ); + if ((handle = dlopen( so_name, RTLD_NOW | RTLD_NOLOAD ))) mapped = TRUE; + else handle = dlopen( so_name, RTLD_NOW ); if (!handle) { WARN( "failed to load .so lib %s: %s\n", debugstr_a(so_name), dlerror() ); @@ -1293,7 +1295,7 @@ static NTSTATUS dlopen_dll( const char *so_name, UNICODE_STRING *nt_name, void * { module = (HMODULE)((nt->OptionalHeader.ImageBase + 0xffff) & ~0xffff); if (get_builtin_so_handle( module )) goto already_loaded; - if (map_so_dll( nt, module )) + if (!mapped && map_so_dll( nt, module )) { dlclose( handle ); return STATUS_NO_MEMORY;