Subject: Re: libpthread and static constructor order
To: None <>
From: J.T. Conklin <>
List: tech-userlevel
Date: 11/06/2007 12:37:42
Joerg Sonnenberger <> writes:
>> > 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...

I see that rtld.c has a _rtld_dag_init() to initialize a DAG from the
objects.  Could the fix be as simple as initializing the DAG (this is
currently only done for dlopen()ed libraries), and then walking the DAG
instead of the list for the init/fini routines?


J.T. Conklin