]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/uclibc/lib/contrib/uclibc/libc/sysdeps/linux/nios/crtbegin.c
update
[l4.git] / l4 / pkg / uclibc / lib / contrib / uclibc / libc / sysdeps / linux / nios / crtbegin.c
1 #include <errno.h>
2 #include <stdlib.h>
3 /*
4 static void (*__CTOR_LIST__[1]) __P((void))
5     __attribute__((__unused__))
6     __attribute__((section(".ctors"))) = { (void *)0 };
7
8 static void (*__DTOR_LIST__[1]) __P((void))
9     __attribute__((section(".dtors"))) = { (void *)-1 };
10 */
11 extern void (*__DTOR_LIST__[]) __P((void));
12 static void     __do_global_dtors_aux __P((void));
13
14 static void
15 __do_global_dtors_aux()
16 {
17         void (**p)(void) = __DTOR_LIST__ + 1;
18
19         while (*p)
20                 (**p++)();
21 }
22
23 static void dummy_fini(void) __attribute__((section(".trash")));
24
25 void
26 dummy_fini(void)
27 {
28         static void (* volatile call__dtors)(void) = __do_global_dtors_aux;
29         /*
30          * Call global destructors.
31          */
32         /* prevent function pointer constant propagation */
33         __asm__ __volatile__ (".section .fini");
34         (*call__dtors)();
35         __asm__ __volatile__ (".section .trash");
36
37 }