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 <damjan....@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....@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)

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
_______________________________________________
freebsd-emulation@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-emulation
To unsubscribe, send any mail to "freebsd-emulation-unsubscr...@freebsd.org"

Reply via email to