From owner-freebsd-emulation@freebsd.org Sun May 24 14:42:36 2020 Return-Path: Delivered-To: freebsd-emulation@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5E49A32F54B for ; Sun, 24 May 2020 14:42:36 +0000 (UTC) (envelope-from gerald@pfeifer.com) Received: from hamza.pair.com (hamza.pair.com [209.68.5.143]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 49VNHH4FvPz47nK for ; Sun, 24 May 2020 14:42:35 +0000 (UTC) (envelope-from gerald@pfeifer.com) Received: from hamza.pair.com (localhost [127.0.0.1]) by hamza.pair.com (Postfix) with ESMTP id E2E2533E30; Sun, 24 May 2020 10:42:34 -0400 (EDT) Received: from [192.168.1.5] (unknown [77.118.196.79]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by hamza.pair.com (Postfix) with ESMTPSA id 810C033E2D; Sun, 24 May 2020 10:42:33 -0400 (EDT) Date: Sun, 24 May 2020 16:42:17 +0200 (CEST) From: Gerald Pfeifer To: Damjan Jovanovic , Konstantin Belousov cc: freebsd-emulation@freebsd.org Subject: Re: Wine 5.9 bugfix In-Reply-To: Message-ID: References: <20200523111633.GO64045@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 49VNHH4FvPz47nK X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of gerald@pfeifer.com designates 209.68.5.143 as permitted sender) smtp.mailfrom=gerald@pfeifer.com X-Spamd-Result: default: False [-2.54 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.05)[-1.046]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+a:hamza.pair.com]; TAGGED_RCPT(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[pfeifer.com]; NEURAL_HAM_LONG(-0.99)[-0.986]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_SHORT(-0.21)[-0.208]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:7859, ipnet:209.68.0.0/18, country:US]; RCVD_TLS_LAST(0.00)[] X-Mailman-Approved-At: Sun, 24 May 2020 17:39:59 +0000 X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2020 14:42:36 -0000 On Sun, 24 May 2020, Damjan Jovanovic wrote: > 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 > 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 > > 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) I wonder whether that's not worth a __FreeBSD_version bump, see https://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/versions-12.html for other examples. Konstantin? (The challenge of course remains when packages are built on/for one specific minor version/patch level, and then deployed on a later or earlier one.) Gerald