Date: Sun, 24 May 2020 19:12:20 +0300 From: Konstantin Belousov <kib@freebsd.org> To: Damjan Jovanovic <damjan.jov@gmail.com> Cc: Gerald Pfeifer <gerald@pfeifer.com>, freebsd-emulation@freebsd.org Subject: Re: Wine 5.9 bugfix Message-ID: <20200524161220.GS64045@kib.kiev.ua> In-Reply-To: <CAJm2B-kR3uJ=iUQMXMu5mRs=ZBJRZvr1J3jj3MHC7FnxE634sw@mail.gmail.com> References: <CAJm2B-m1JU%2B6J88=7r19cP9y=UXV%2BYmMQwoJgA_Ce1-bWPjiKA@mail.gmail.com> <20200523111633.GO64045@kib.kiev.ua> <CAJm2B-=KYW0aiiEfeE87dv9-cbACY0L_Bj%2BSjp-33kJvuF81Qw@mail.gmail.com> <alpine.LSU.2.21.2005232033330.4832@anthias.pfeifer.com> <CAJm2B-=ovDqprxPy4zt6btNBfTDjGWLcatEr786yhzjdePwS6w@mail.gmail.com> <alpine.LSU.2.21.2005232118280.4832@anthias.pfeifer.com> <CAJm2B-kXrGB88k-oFxH2Le2N---fEL_AUHXQdxgoh-hfM9Jz4Q@mail.gmail.com> <20200524144858.GR64045@kib.kiev.ua> <CAJm2B-kR3uJ=iUQMXMu5mRs=ZBJRZvr1J3jj3MHC7FnxE634sw@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, May 24, 2020 at 05:29:55PM +0200, Damjan Jovanovic wrote: > On Sun, May 24, 2020 at 4:49 PM Konstantin Belousov <kostikbel@gmail.com> > wrote: > > > On Sun, May 24, 2020 at 03:45:47PM +0200, Damjan Jovanovic wrote: > > > On Sun, May 24, 2020 at 3:40 PM Gerald Pfeifer <gerald@pfeifer.com> > > wrote: > > > > > > > On Sat, 23 May 2020, Damjan Jovanovic wrote: > > > > > For Wine. I'll submit it upstream when the rtld-elf patch goes into > > > > > stable/12. > > > > > > > > What will happen to users on FreeBSD 11 (or 12 before the rtld-elf > > > > patch) when that additional patch goes into upstream Wine? > > > > > > > > Gerald > > > > > > > > > > This is the patch I would send, it effectively changes 2 lines to check > > an > > > extra condition (__FreeBSD_version < 1202000): > > > > > > > > > commit c81fc2e8dc75c5dcab300da4fa6cc6ccfb0c3d15 (freebsd-mmap) > > > Author: Damjan Jovanovic <damjan.jov@gmail.com> > > > Date: Sat May 23 13:49:31 2020 +0200 > > > > > > ntdll: only use the link_map.l_addr workaround on FreeBSD < 12.2 > > > > > > FreeBSD 12.2 will change the meaning of link_map.l_addr to be > > > the offset from file addresses to RAM addresses, like it is in > > > Linux/NetBSD/Illumos > > > (https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=246561) > > > > > > Signed-off-by: Damjan Jovanovic <damjan.jov@gmail.com> > > > > > > diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c > > > index 6e41b37ad8..bdd7794683 100644 > > > --- a/dlls/ntdll/loader.c > > > +++ b/dlls/ntdll/loader.c > > > @@ -1317,7 +1317,7 @@ static void call_tls_callbacks( HMODULE module, > > UINT > > > reason ) > > > } > > > } > > > > > > -#ifdef __FreeBSD__ > > > +#if defined(__FreeBSD__) && (__FreeBSD_version < 1202000) > > > /* The PT_LOAD segments are sorted in increasing order, and the first > > > * starts at the beginning of the ELF file. By parsing the file, we can > > > * find that first PT_LOAD segment, from which we can find the base > > > @@ -1370,7 +1370,7 @@ static void call_constructors( WINE_MODREF *wm ) > > > { > > > caddr_t relocbase = (caddr_t)map->l_addr; > > > > > > -#ifdef __FreeBSD__ /* FreeBSD doesn't relocate l_addr */ > > > +#if defined(__FreeBSD__) && (__FreeBSD_version < 1202000) /* FreeBSD > > > doesn't relocate l_addr */ > > > if (!get_relocbase(map->l_addr, &relocbase)) return; > > > #endif > > > switch (dyn->d_tag) > > Can you check for presence of link_map.l_base instead of looking for > > the version ? Configure scripts should easily handle this. > > > > There is no link_map.l_base in your commit: > https://svnweb.freebsd.org/base/head/sys/sys/link_elf.h?r1=326256&r2=361303&pathrev=361303 It was added later when initial commit was partially reverted. Or rather, l_addr was renamed to l_base, see r361349. In fact Gerald' concern that there is no __FreeBSD_version for the feature is valid, but bigger problem is that __FreeBSD_version is never useful for anything in userspace, esp. if compilation environment might be different from runtime. I propose the following to detect the new behavior for l_addr: https://reviews.freebsd.org/D24982
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20200524161220.GS64045>