Subject: Re: why ld.elf_so is slow starting mozilla
To: David Laight <david@l8s.co.uk>
From: Charles M. Hannum <abuse@spamalicious.com>
List: tech-toolchain
Date: 10/03/2002 00:00:38
>> That said, your `realisation' is not new.  It is in fact the origin of
>> the `mark' code, which I had to remove to fix other problems that it
>> caused.
>
> How long ago was that, I might read up what it was and why it was
> borken before re-implementing it!

It violated a fundamental rule: the lazy binder entry path MUST be
reentrant.  This is critical for both signal handling and for threaded
environments.  The corollary to this is that it must not have side
effects (other than, in a thread-safe way, patching the PLT and/or
GOT, as appropriate for the platform).

The `mark' code modified and relied on global state which was affected
by calls from within signal handlers, and could be affected by other
threads.  It was not safe, it failed, and it was removed with extreme
prejudice.  Do not reinvent it, rewrite it, reformulate it, or
otherwise attempt to bring it back.

There may be other ways to do the same thing without side effects, but
I have a feeling they will add unwanted overhead in the normal case.