fix regression that made shared libs crash on arm
[musl] / crt / arm / crti.s
1 .section .init
2 .global _init
3 _init:
4         push {r0,r1,r2,r4,r5,lr}
5
6 .weak __fini_array_start
7 .weak __fini_array_end
8 .hidden __fini_array_start
9 .hidden __fini_array_end
10
11 .section .fini
12 .global _fini
13 _fini:
14         push {r4,r5,r6,lr}
15         adr lr, 1f
16         ldr r4, 2f
17         ldr r5, 2f+4
18         add r4, r4, lr
19         add r5, r5, lr
20 1:      adr lr, 1b
21         cmp r4, r5
22         beq 3f
23         ldmia r4!, {r3}
24         tst r3,#1
25         moveq pc,r3
26         bx r3
27 2:      .word __fini_array_start-1b
28         .word __fini_array_end-1b
29 3: