ntdll: Fix ELF initializer address calculations on FreeBSD.
commit0fd3f0266e05f6afa710fa2b5a254b0ed88bac0f
authorDamjan Jovanovic <damjan.jov@gmail.com>
Sun, 17 May 2020 10:49:08 +0000 (17 12:49 +0200)
committerAlexandre Julliard <julliard@winehq.org>
Mon, 18 May 2020 10:08:36 +0000 (18 12:08 +0200)
tree99a37ba74e446fff32673cdfa7cfdce1cd0ff5ac
parent0f31e48e9ba28ba8c0aee0678567d6b47e3c63aa
ntdll: Fix ELF initializer address calculations on FreeBSD.

dlinfo() doesn't conform to a standard, each platform implements in differently,
if at all. On GNU and NetBSD its l_addr field returned is the "relocbase",
the relative offset between addresses wanted by the file and addresses obtained
in memory (==0 when no relocation occurred), which we add to d_un.d_ptr to
obtain the memory address where the initializer is. On FreeBSD (and possibly
Solaris) this won't work, as l_addr is the "mapbase" instead, the absolute
starting memory address where the binary was loaded, resulting in wrong
calculations and crashes on startup as we call into wrong addresses.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49139
Signed-off-by: Damjan Jovanovic <damjan.jov@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
dlls/ntdll/loader.c