Annotation of dietlibc/dyn_start.c, revision 1.5

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.4       olaf       20: __attribute__((section(".fini"))) void _fini(void);
1.1       olaf       21: __attribute__((section(".fini"))) void _fini(void)
                     22: {
                     23:   __do_global_dtors_aux();
                     24: }
                     25: 
1.3       olaf       26: /* pre main, post _start */
1.5     ! olaf       27: int _dyn_start(int argc, char **argv, char **envp, structor dl_init);
1.3       olaf       28: int _dyn_start(int argc, char **argv, char **envp, structor dl_init)
1.1       olaf       29: {
                     30:   static __attribute__((section(".init"))) void _init(void);
                     31:   int main(int argc, char **argv, char **envp);
                     32: 
                     33:   if (dl_init) atexit(dl_init);
                     34:   _init();
                     35:   atexit(_fini);
                     36:   return main(argc, argv, envp);
                     37: }
1.2       olaf       38: #endif

LinuxTV legacy CVS <linuxtv.org/cvs>