[PATCH] ntdll: interpretation of l_addr depends on FreeBSD version
Damjan Jovanovic
damjan.jov at gmail.com
Tue Jun 9 22:15:20 CDT 2020
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 at gmail.com>
---
dlls/ntdll/loader.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
-------------- next part --------------
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index 0c8f05285c..c2e65c94ab 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -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)
{
More information about the wine-devel
mailing list