ntdll: Interpretation of l_addr depends on FreeBSD version.

FreeBSD changed l_addr to mean the relocation offset like it
does on other OSes, and provided a dynamic linker symbol,
"_rtld_version_laddr_offset", that can be used to check the
meaning.

Signed-off-by: Damjan Jovanovic <damjan.jov@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Damjan Jovanovic 2020-06-10 05:15:20 +02:00 committed by Alexandre Julliard
parent fed3784ab0
commit f728a5f3f9
1 changed files with 4 additions and 2 deletions

View File

@ -1372,8 +1372,10 @@ static void call_constructors( WINE_MODREF *wm )
{
caddr_t relocbase = (caddr_t)map->l_addr;
#ifdef __FreeBSD__ /* FreeBSD doesn't relocate l_addr */
if (!get_relocbase(map->l_addr, &relocbase)) return;
#ifdef __FreeBSD__
/* On older FreeBSD versions, l_addr was the absolute load address, now it's the relocation offset. */
if (!dlsym(RTLD_DEFAULT, "_rtld_version_laddr_offset"))
if (!get_relocbase(map->l_addr, &relocbase)) return;
#endif
switch (dyn->d_tag)
{