Subject: Re: libpthread and static constructor order
To: None <email@example.com>
From: J.T. Conklin <firstname.lastname@example.org>
Date: 11/02/2007 06:57:56
> 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.
The ACE / TAO shared libraries were built with GNU libtool, and I
discovered that libtool links the shared libraries with -nostdlib,
even with -pthread the libpthread dependency was not recorded. I
changed it to use -nostartfiles instead, which appeared to work
(libpthread was shown before libACE, etc. when doing a "ldd" on both
the shared libraries and executables); but the libpthread ctor was
still called after some of the TAO ctors that used threads.
I'll look into this approach further know that I know that this
"should" work rather than something that "might" work.