blob: 7fb228083661a508349326818c3812bee0e2760c [file] [log] [blame]
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08001.text
2.align 4
3.type __bionic_call_ctors, @function
4
5/*
6 * The CTORS_LIST is marked by -1 (start) and 0 (end).
7 * We mark the end of the .ctors section with the __CTOR_END__ section so
8 * that we can just iterate backwards from it until we hit -1 and execute
9 * all the function pointers. This seems to be the way to do it for SVR4
10 * derived systems.
11 */
12__bionic_call_ctors:
13 pushl %esi
14 mov $__CTOR_END__, %esi
15
160:
17 /* now grab the next function pointer and check if its -1. If not,
18 * call it, otherwise we're done. We use %esi since it's callee saved.
19 */
20 subl $4, %esi
21 mov (%esi), %eax
22 cmp $0xffffffff, %eax
23 je 1f
24 call *%eax
25 jmp 0b
26
271:
28 /* we're done */
29 popl %esi
30 ret
31
32.section .init
33.align 4
34 call __bionic_call_ctors
35 ret
36
37.section .ctors, "aw", @progbits
38.align 4
39.type __CTOR_END__, @object
40__CTOR_END__:
41 .long 0
42
43.section .init_array, "aw"
44 .long 0
45
46.section .fini_array, "aw"
47 .long 0