Annotation of dietlibc/dyn_start.c, revision 1.8
1.2 olaf 1: #include "dietfeatures.h"
2:
3: #ifdef WANT_DYNAMIC
1.1 olaf 4: #include <stdlib.h>
5:
6: typedef void(*structor)(void);
7:
8: __attribute__((section(".ctors")))
9: static structor __CTOR_LIST__[1]={((structor)-1)};
10:
11: __attribute__((section(".dtors")))
12: static structor __DTOR_LIST__[1]={((structor)-1)};
13:
14: static void __do_global_dtors_aux(void)
15: {
16: structor *df=__CTOR_LIST__; /* ugly trick to prevent warning */
17: for (df=((__DTOR_LIST__)+1);(*df) != (structor)0; df++) (*df)();
18: }
19:
1.7 olaf 20: void _fini(void) __attribute__((section(".fini")));
1.1 olaf 21: __attribute__((section(".fini"))) void _fini(void)
22: {
23: __do_global_dtors_aux();
24: }
25:
1.6 olaf 26: #ifndef __DYN_LIB_SHARED
1.3 olaf 27: /* pre main, post _start */
1.5 olaf 28: int _dyn_start(int argc, char **argv, char **envp, structor dl_init);
1.3 olaf 29: int _dyn_start(int argc, char **argv, char **envp, structor dl_init)
1.1 olaf 30: {
31: static __attribute__((section(".init"))) void _init(void);
32: int main(int argc, char **argv, char **envp);
33:
34: if (dl_init) atexit(dl_init);
35: _init();
36: atexit(_fini);
1.8 ! sanjiyan 37: #ifdef WANT_STACKGAP
! 38: return stackgap(argc, argv, envp);
! 39: #else
1.1 olaf 40: return main(argc, argv, envp);
1.8 ! sanjiyan 41: #endif
1.1 olaf 42: }
1.6 olaf 43: #endif
1.2 olaf 44: #endif
LinuxTV legacy CVS <linuxtv.org/cvs>