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.
5 # We test both dynamic loader sorting algorithms
6 tunable_option
: glibc.rtld.dynamic_sort
=1
7 tunable_option
: glibc.rtld.dynamic_sort
=2
9 # Sequence of single dependencies with no cycles.
10 tst
-dso
-ordering1
: a
->b
->c
11 output
: c
>b
>a
>{}<a
<b
<c
13 # Sequence including
2 dependent DSOs not at the end of the graph.
14 tst
-dso
-ordering2
: a
->b
->[cd
]->e
15 output
: e
>d
>c
>b
>a
>{}<a
<b
<c
<d
<e
17 # Complex order with
3 "layers" of full dependencies
18 tst
-dso
-ordering3
: a
->[bc
]->[def
]->[gh
]->i
19 output
: i
>h
>g
>f
>e
>d
>c
>b
>a
>{}<a
<b
<c
<d
<e
<f
<g
<h
<i
21 # Sequence including
2 dependent DSOs at the end of the graph.
22 # Additionally the same dependencies appear in two paths.
23 tst
-dso
-ordering4
: a
->b
->[de
];a
->c
->d
->e
24 output
: e
>d
>c
>b
>a
>{}<a
<b
<c
<d
<e
26 # Test that b
->c cross link is respected correctly
27 tst
-dso
-ordering5
: a
!->[bc
]->d
;b
->c
28 output
: d
>c
>b
>a
>{}<a
<b
<c
<d
30 # First DSO fully dependent on
4 DSOs
, with another DSO at the end of chain.
31 tst
-dso
-ordering6
: a
->[bcde
]->f
32 output
: f
>e
>d
>c
>b
>a
>{}<a
<b
<c
<d
<e
<f
34 # Sequence including
2 dependent and
3 dependent DSOs
, and one of the
35 # dependent DSOs is dependent on an earlier DSO.
36 tst
-dso
-ordering7
: a
->[bc
];b
->[cde
];e
->f
37 output
: f
>e
>d
>c
>b
>a
>{}<a
<b
<c
<d
<e
<f
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.
42 tst
-dso
-ordering8
: a
->b
->c
=>a
;{}->[ba
]
43 output
: c
>b
>a
>{}<a
<b
<c
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
47 tst
-dso
-ordering9
: a
->b
->c
->d
->e
;{}!->[abcde
]
48 output
: e
>d
>c
>b
>a
>{}<a
<b
<c
<d
<e
50 # Test if init
/fini ordering behavior is proper
, despite main program with
51 # an soname that may cause confusion
52 tst
-dso
-ordering10
: {}->a
->b
->c
;soname({})=c
55 # Complex example from Bugzilla #
15311, under
-linked and with circular
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.
64 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
65 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
];}
66 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
];}
68 # Test that even in the presence of dependency loops involving dlopen
'ed
69 # object, that object is initialized last (and not unloaded prematurely).
70 # Final destructor order is indeterminate due to the cycle.
71 tst-bz28937: {+a;+b;-b;+c;%c};a->a1;a->a2;a2->a;b->b1;c->a1;c=>a1
72 output(glibc.rtld.dynamic_sort=1): {+a[a2>a1>a>];+b[b1>b>];-b[<b<b1];+c[c>];%c(a1());}<a<a2<c<a1
73 output(glibc.rtld.dynamic_sort=2): {+a[a2>a1>a>];+b[b1>b>];-b[<b<b1];+c[c>];%c(a1());}<a2<a<c<a1