Annotation of dietlibc/dyn_start.c, revision 1.10
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.9 leitner 26: #ifdef WANT_STACKGAP
27: int stackgap(int argc,char* argv[],char* envp[]);
28: #endif
29:
1.6 olaf 30: #ifndef __DYN_LIB_SHARED
1.3 olaf 31: /* pre main, post _start */
1.10 ! leitner 32: static __attribute__((section(".init"))) void _init(void);
! 33:
1.5 olaf 34: int _dyn_start(int argc, char **argv, char **envp, structor dl_init);
1.3 olaf 35: int _dyn_start(int argc, char **argv, char **envp, structor dl_init)
1.1 olaf 36: {
37: int main(int argc, char **argv, char **envp);
38:
39: if (dl_init) atexit(dl_init);
40: _init();
41: atexit(_fini);
1.8 sanjiyan 42: #ifdef WANT_STACKGAP
43: return stackgap(argc, argv, envp);
44: #else
1.1 olaf 45: return main(argc, argv, envp);
1.8 sanjiyan 46: #endif
1.1 olaf 47: }
1.6 olaf 48: #endif
1.2 olaf 49: #endif
LinuxTV legacy CVS <linuxtv.org/cvs>