Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: a61f205e9a6d22695153d4687b0a6f9873e20412
      
https://github.com/Perl/perl5/commit/a61f205e9a6d22695153d4687b0a6f9873e20412
  Author: Tony Cook <t...@develop-help.com>
  Date:   2025-04-24 (Thu, 24 Apr 2025)

  Changed paths:
    M Makefile.SH

  Log Message:
  -----------
  cygwin: give cygperl*.dll an explicit base address

Cygwin's fork emulation doesn't handle overlapping addresses
between different DLLs, since it tries to lay out the address space
of the child process to match the parent process, but if there's an
address conflict between DLLs, Windows may load those DLLs at
different addresses.

To avoid having to manually assign addresses to each DLL, since
around 5.10 we've used --enable-auto-image-base to assign load
addresses for cygperl*.dll and dynamic extension DLLs and this
has mostly worked well, but as perl has gotten larger and
cygperl*.dll has grown, we've had two cases where there's overlap
between the address space for cygperl*.dll and some extension
DLL, see #22695 and #22104.

This problem occurs because:

- cygperl*.dll is large, and with -DDEBUGGING or some other option
  that increases binary size, even large, occupying more than one of
  the "slots" that the automatic image base code in ld can assign
  the DLL to.

- unlike the extension DLLs, the name of cygperl*.dll changes with
  every release, so we roll the dice each release on whether there
  will be a conflict between cygperl*.dll and some other DLL.

Previously I've added an entry to perldelta and updated the CI
workflow to workaround the conflict, this change should prevent
that particular conflict.

The addresses I've chosen here are "just" (for large values of
"just") below the base address range used by automatic address
space selection.

For 64-bit this was done by inspection, examing the output of
"rebase -i" on the extension DLLs and looking at the source of ld,
in particular:

  
https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=ld/emultempl/pep.em;h=00c4ea9e15a765c29b15b621f53d6bfcb499e5ed;hb=HEAD#l144

Note cygwin builds set move_default_addr_high=1 if you read that code.

For 32-bit I just looked at the source:

  
https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=ld/emultempl/pe.em;h=52f59b8b#l173

since I don't have a 32-bit cygwin install any more, since cygwin
no longer ship it and it commonly had the fork address conflicts
discussed above.

I would have liked to make the load address configurable via
-Dcygperl_base or similar, but I didn't see a way to get the
base address to pass from Configure through to Makefile.SH.

Fixes #22695


  Commit: a59dd53e9b50b817c7528ab28fd6e72b441db3aa
      
https://github.com/Perl/perl5/commit/a59dd53e9b50b817c7528ab28fd6e72b441db3aa
  Author: Tony Cook <t...@develop-help.com>
  Date:   2025-04-24 (Thu, 24 Apr 2025)

  Changed paths:
    M .github/workflows/testsuite.yml

  Log Message:
  -----------
  Revert "cygwin: workaround DLL load address conflict"

This reverts commit ff4c75e237e9d4f574da4e379bcc20e2604bf79f.


  Commit: 3c2aa9fef064d0f6a90cb7999b1ca7a4fac4be3a
      
https://github.com/Perl/perl5/commit/3c2aa9fef064d0f6a90cb7999b1ca7a4fac4be3a
  Author: Tony Cook <t...@develop-help.com>
  Date:   2025-04-24 (Thu, 24 Apr 2025)

  Changed paths:
    M pod/perldelta.pod

  Log Message:
  -----------
  perldelta for setting cygperl*.dll image base


Compare: https://github.com/Perl/perl5/compare/a73c27715951...3c2aa9fef064

To unsubscribe from these emails, change your notification settings at 
https://github.com/Perl/perl5/settings/notifications

Reply via email to