]> git.ipfire.org Git - thirdparty/glibc.git/blame - elf/dso-sort-tests-1.def
Revert "elf: Always call destructors in reverse constructor order (bug 30785)"
[thirdparty/glibc.git] / elf / dso-sort-tests-1.def
CommitLineData
e6fd79f3
CLT
1# DSO sorting test descriptions.
2# This file is to be processed by ../scripts/dso-ordering-test.py, see usage
3# in elf/Makefile for how it is executed.
4
5# We test both dynamic loader sorting algorithms
6tunable_option: glibc.rtld.dynamic_sort=1
7tunable_option: glibc.rtld.dynamic_sort=2
8
9# Sequence of single dependencies with no cycles.
10tst-dso-ordering1: a->b->c
11output: c>b>a>{}<a<b<c
12
13# Sequence including 2 dependent DSOs not at the end of the graph.
14tst-dso-ordering2: a->b->[cd]->e
15output: e>d>c>b>a>{}<a<b<c<d<e
16
17# Complex order with 3 "layers" of full dependencies
18tst-dso-ordering3: a->[bc]->[def]->[gh]->i
19output: i>h>g>f>e>d>c>b>a>{}<a<b<c<d<e<f<g<h<i
20
21# Sequence including 2 dependent DSOs at the end of the graph.
22# Additionally the same dependencies appear in two paths.
23tst-dso-ordering4: a->b->[de];a->c->d->e
24output: e>d>c>b>a>{}<a<b<c<d<e
25
26# Test that b->c cross link is respected correctly
27tst-dso-ordering5: a!->[bc]->d;b->c
28output: d>c>b>a>{}<a<b<c<d
29
30# First DSO fully dependent on 4 DSOs, with another DSO at the end of chain.
31tst-dso-ordering6: a->[bcde]->f
32output: f>e>d>c>b>a>{}<a<b<c<d<e<f
33
34# Sequence including 2 dependent and 3 dependent DSOs, and one of the
35# dependent DSOs is dependent on an earlier DSO.
36tst-dso-ordering7: a->[bc];b->[cde];e->f
37output: f>e>d>c>b>a>{}<a<b<c<d<e<f
38
39# Sequence where the DSO c is unerlinked and calls a function in DSO a which
40# is technically a cycle. The main executable depends on the first two DSOs.
41# Note: This test has unspecified behavior.
42tst-dso-ordering8: a->b->c=>a;{}->[ba]
43output: c>b>a>{}<a<b<c
44
45# Generate the permutation of DT_NEEDED order between the main binary and
46# all 5 DSOs; all link orders should produce exact same init/fini ordering
47tst-dso-ordering9: a->b->c->d->e;{}!->[abcde]
48output: e>d>c>b>a>{}<a<b<c<d<e
49
50# Test if init/fini ordering behavior is proper, despite main program with
51# an soname that may cause confusion
52tst-dso-ordering10: {}->a->b->c;soname({})=c
53output: b>a>{}<a<b
54
55# Complex example from Bugzilla #15311, under-linked and with circular
dd32e1db
FW
56# relocation(dynamic) dependencies. While this is technically unspecified, the
57# presumed reasonable practical behavior is for the destructor order to respect
58# the static DT_NEEDED links (here this means the a->b->c->d order).
59# The older dynamic_sort=1 algorithm does not achieve this, while the DFS-based
60# dynamic_sort=2 algorithm does, although it is still arguable whether going
61# beyond spec to do this is the right thing to do.
62# The below expected outputs are what the two algorithms currently produce
63# respectively, for regression testing purposes.
e6fd79f3 64tst-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
dd32e1db
FW
65output(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];}
66output(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];}
1df71d32
FW
67
68# Test that even in the presence of dependency loops involving dlopen'ed
69# object, that object is initialized last (and not unloaded prematurely).
dd32e1db 70# Final destructor order is indeterminate due to the cycle.
1df71d32 71tst-bz28937: {+a;+b;-b;+c;%c};a->a1;a->a2;a2->a;b->b1;c->a1;c=>a1
dd32e1db
FW
72output(glibc.rtld.dynamic_sort=1): {+a[a2>a1>a>];+b[b1>b>];-b[<b<b1];+c[c>];%c(a1());}<a<a2<c<a1
73output(glibc.rtld.dynamic_sort=2): {+a[a2>a1>a>];+b[b1>b>];-b[<b<b1];+c[c>];%c(a1());}<a2<a<c<a1