Subject: Re: libpthread and static constructor order
To: None <firstname.lastname@example.org>
From: J.T. Conklin <email@example.com>
Date: 11/06/2007 12:37:42
Joerg Sonnenberger <firstname.lastname@example.org> 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?