Subject: Re: libpthread and static constructor order
To: None <tech-userlevel@netbsd.org>
From: Joerg Sonnenberger <joerg@britannica.bec.de>
List: tech-userlevel
Date: 11/02/2007 15:01:15
On Fri, Nov 02, 2007 at 06:57:56AM -0700, J.T. Conklin wrote:
> > On Thu, Nov 01, 2007 at 08:53:53PM -0700, J.T. Conklin wrote:
> >> I'm running into this problem now with ACE / TAO, which has static
> >> ctors which end up using pthread's thread specific storage.
> >
> > In that case the library has to explicitly link against libpthread. ELF
> > constructors are run in dependency order and if you can build the
> > library with -z defs, you should be on the save side.
> 
> Hmm... This is something I tried yesterday without much success.

Note that what I said above is how it *should* behave. From reading
ld.elf_so I am not sure whether it is actually doing that. Can you check
in which order the DT_NEEDED entries are in the binary? I think the part
about resorting the order list is not done at all...

Joerg