This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 1/2][RFC] #17645, fix slow DSO sorting behavior in dynamic loader
- From: Chung-Lin Tang <chunglin_tang at mentor dot com>
- To: Florian Weimer <fweimer at redhat dot com>
- Cc: <cltang at codesourcery dot com>, GNU C Library <libc-alpha at sourceware dot org>
- Date: Mon, 5 Aug 2019 18:39:07 +0800
- Subject: Re: [PATCH 1/2][RFC] #17645, fix slow DSO sorting behavior in dynamic loader
- References: <bb13d870-a1f2-94fa-cf9e-9d78ad1fe4ee@mentor.com> <87h87crimv.fsf@oldenburg2.str.redhat.com> <fd8d80af-c01d-0f2d-8082-ecc8c5537600@mentor.com> <87wog15fyy.fsf@oldenburg2.str.redhat.com>
- Reply-to: <cltang at codesourcery dot com>
On 2019/7/29 5:48 PM, Florian Weimer wrote:
* Chung-Lin Tang:
Can your test framework test both cases? What's your position on the
second effect? I think it sometimes results in destructors running not
in the opposite order of constructors, due to the new topological sort.
(This also happens with the current implementation.)
What I did in the ld.so code patch was add a second pass of sorting
that ignores runtime deps, prioritizing link dependencies; this
appears to also be what prior discussion pointed towards, see more
details in that 2nd email with the actual code patch.
I wonder if it makes sense to disentangle this (desirable) functional
change from the rest (which sould be purely an optimization).
By "functional change" here, are you referring to the testing framework,
or the described ld.so destructor behavior I described above?
Is it even necessary to re-sort on dlclose? Is the original dependency
order available somewhere? Then we could make it explicit that the
destructor order is the reverse of the constructor order (for the
objects unloaded). Or is there a corner case which causes an expected
divergence?
Dynamic loaded objects could add more relocation dependencies, and thus augment
the dependency relations (by adding more constraints), so a final sort should
still be required.
Thanks,
Chung-Lin