From 6a12d93b88145cb1f31e89c6faca39184fb819ca Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Thu, 14 May 2020 12:24:57 +0200 Subject: [PATCH] ntdll: Handle already relocated .dynamic entries. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49139 Signed-off-by: Alexandre Julliard --- dlls/ntdll/loader.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index b5091e2b562..814a600f2e7 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -1340,12 +1340,14 @@ static void call_constructors( WINE_MODREF *wm ) if (dlinfo( wm->so_handle, RTLD_DI_LINKMAP, &map ) == -1) return; for (dyn = map->l_ld; dyn->d_tag; dyn++) { +#define GET_PTR(base,ptr) ((ptr) > (base) ? (ptr) : (base) + (ptr)) switch (dyn->d_tag) { - case 0x60009990: init_array = (void *)((char *)map->l_addr + dyn->d_un.d_val); break; + case 0x60009990: init_array = (void *)GET_PTR( map->l_addr, dyn->d_un.d_ptr ); break; case 0x60009991: init_arraysz = dyn->d_un.d_val; break; - case 0x60009992: init_func = (void *)((char *)map->l_addr + dyn->d_un.d_val); break; + case 0x60009992: init_func = (void *)GET_PTR( map->l_addr, dyn->d_un.d_ptr ); break; } +#undef GET_PTR } TRACE( "%s: got init_func %p init_array %p %lu\n", debugstr_us( &wm->ldr.BaseDllName ),