diff options
author | Florian Weimer <fweimer@redhat.com> | 2022-09-20 11:00:42 +0200 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2022-09-20 11:00:42 +0200 |
commit | 1df71d32fe5f5905ffd5d100e5e9ca8ad6210891 (patch) | |
tree | 6a747a087b99a4a5e0fbdcbe8959d378f0996170 /elf/dso-sort-tests-1.def | |
parent | 766b73768b290b303f5b56268c6c0d588d5a9267 (diff) | |
download | glibc-1df71d32fe5f5905ffd5d100e5e9ca8ad6210891.zip glibc-1df71d32fe5f5905ffd5d100e5e9ca8ad6210891.tar.gz glibc-1df71d32fe5f5905ffd5d100e5e9ca8ad6210891.tar.bz2 |
elf: Implement force_first handling in _dl_sort_maps_dfs (bug 28937)
The implementation in _dl_close_worker requires that the first
element of l_initfini is always this very map (“We are always the
zeroth entry, and since we don't include ourselves in the
dependency analysis start at 1.”). Rather than fixing that
assumption, this commit adds an implementation of the force_first
argument to the new dependency sorting algorithm. This also means
that the directly dlopen'ed shared object is always initialized last,
which is the least surprising behavior in the presence of cycles.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Diffstat (limited to 'elf/dso-sort-tests-1.def')
-rw-r--r-- | elf/dso-sort-tests-1.def | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/elf/dso-sort-tests-1.def b/elf/dso-sort-tests-1.def index 5f7f18e..4bf9052 100644 --- a/elf/dso-sort-tests-1.def +++ b/elf/dso-sort-tests-1.def @@ -64,3 +64,10 @@ output: b>a>{}<a<b tst-bz15311: {+a;+e;+f;+g;+d;%d;-d;-g;-f;-e;-a};a->b->c->d;d=>[ba];c=>a;b=>e=>a;c=>f=>b;d=>g=>c output(glibc.rtld.dynamic_sort=1): {+a[d>c>b>a>];+e[e>];+f[f>];+g[g>];+d[];%d(b(e(a()))a()g(c(a()f(b(e(a()))))));-d[];-g[];-f[];-e[];-a[<a<c<d<g<f<b<e];} output(glibc.rtld.dynamic_sort=2): {+a[d>c>b>a>];+e[e>];+f[f>];+g[g>];+d[];%d(b(e(a()))a()g(c(a()f(b(e(a()))))));-d[];-g[];-f[];-e[];-a[<g<f<a<b<c<d<e];} + +# Test that even in the presence of dependency loops involving dlopen'ed +# object, that object is initialized last (and not unloaded prematurely). +# Final destructor order is indeterminate due to the cycle. +tst-bz28937: {+a;+b;-b;+c;%c};a->a1;a->a2;a2->a;b->b1;c->a1;c=>a1 +output(glibc.rtld.dynamic_sort=1): {+a[a2>a1>a>];+b[b1>b>];-b[<b<b1];+c[c>];%c(a1());}<a<a2<c<a1 +output(glibc.rtld.dynamic_sort=2): {+a[a2>a1>a>];+b[b1>b>];-b[<b<b1];+c[c>];%c(a1());}<a2<a<c<a1 |