[Bug 49139] Regression: Wine crashes on startup on FreeBSD >= 5.7

WineHQ Bugzilla wine-bugs at winehq.org
Mon May 18 18:05:58 CDT 2020


https://bugs.winehq.org/show_bug.cgi?id=49139

--- Comment #12 from Alex S <iwtcex at gmail.com> ---
(In reply to Damjan Jovanovic from comment #11)

> So if I am reading that correctly, OpenIndiana returns the relocbase in
> link_map.l_addr like GNU and NetBSD.

This is probably worth bringing to the FreeBSD bug tracker or some mailing
list.


(In reply to Damjan Jovanovic from comment #9)

> Now what "l_addr + d_un.d_ptr" does on FreeBSD, is add 30000 + 20150 =
> 50150, which is always wrong.

I actually have some code doing exactly that.

Looking at
https://github.com/freebsd/freebsd/blob/d4300f6714811c0a28c0a701ae28952e5758fdaf/libexec/rtld-elf/map_object.c#L292:

Obj_Entry *
map_object(int fd, const char *path, const struct stat *sb)
{
...
    base_vaddr = trunc_page(segs[0]->p_vaddr);
...
    base_addr = (caddr_t) base_vaddr;
...
    mapbase = mmap(base_addr, mapsize, PROT_NONE, base_flags, -1, 0);
...
    if (base_addr != NULL && mapbase != base_addr) {
        _rtld_error("%s: mmap returned wrong address: wanted %p, got %p",
            path, base_addr, mapbase);
        goto error1;
    }
...
    obj->mapbase = mapbase;
    obj->mapsize = mapsize
    obj->vaddrbase = base_vaddr;
    obj->relocbase = mapbase - base_vaddr;
...
}

Thus, if p_vaddr == 0 --> mapbase == relocbase otherwise if p_vaddr != 0 -->
relocbase == 0. Default vaddr value seems to be 0 with gcc (and 0x40 with
clang). Well, at least that explains why I didn't bump into this issue.

-- 
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.



More information about the wine-bugs mailing list