This is the mail archive of the cygwin-patches mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH RFC] fork: reduce chances for "address space is already occupied" errors


Hi Michael,

On Apr  3 14:22, Corinna Vinschen wrote:
> On Apr  3 11:18, Michael Haubenwallner wrote:
> > On 4/1/19 5:56 PM, Corinna Vinschen wrote:
> > > On Apr  1 16:56, Corinna Vinschen wrote:
> > >> On Apr  1 16:28, Michael Haubenwallner wrote:
> > >>> On 3/28/19 9:30 PM, Corinna Vinschen wrote:
> > >>>> can you please collect the base addresses of all DLLs generated during
> > >>>> the build, plus their size and make a sorted list?  It would be
> > >>>> interesting to know if the hash algorithm in ld is actually as bad
> > >>>> as I conjecture.
> > >>>
> > >>> Please find attached the output of rebase -i for the dlls after bootstrap
> > >>> on Cygwin 3.0.4, each built with ld from binutils-2.31.1.
> > > 
> > > Oh, wait.  That's not what I was looking for.  The addresses are ok, but
> > > the paths *must* be the ones at the time the DLLs have been created,
> > > because that's what ld uses when creating the image base addresses.  The
> > > addresses combined with the installation paths don't make sense anymore.
> > 
> > So I have intercepted the ld.exe to show 'rebase -i' on any just created dll,
> > tell about the exact -o argument to ld, and the current directory.
> > 
> > This is with binutils-2.31.1
> > 
> > Anything else needed?
> 
> No, that should be sufficient, thanks for collecting this!

Nick Clifton, one of the binutils maintainers, made the following
suggestion in PM:

Allow the ld flag --enable-auto-image-base to take a filename as
argument.

The idea: The file is used by ld to generate the start address
for the next built DLL.  Mechanism:

1.1. If ld links a DLL and if the file given to --enable-auto-image-base
     doesn't exist, ld will give the DLL the start address of the
     auto image base range.

1.2: Next time, if ld links a DLL and if the file given to
     --enable-auto-image-base exists, it will use the address in that
     file as the start address for th just built DLL.

2. It will store that address, plus the size of the DLL, rounded up to
   64K, in that file.

3. If the auto image base range is at an end, ld will wrap back to
   the start address of the auto image base range.

TBD: A way to enable this feature without having to change all
     packages' build systems.

That way you could build hundreds of DLLs in a project and use them
immediately without having to rebase.

This is just in a discussion state, nothing has happend yet, but
what do you think in general?


Corinna

-- 
Corinna Vinschen
Cygwin Maintainer

Attachment: signature.asc
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]