3 * - C Runtime 0 Common Code
6 typedef void (*exithandler_t)(void);
7 typedef void (*constructor_t)(void);
9 constructor_t _crtbegin_ctors[0] __attribute__((section(".ctors")));
11 exithandler_t _crt0_exit_handler;
12 extern void _init(void);
13 extern void _fini(void);
14 extern void _exit(int status) __attribute__((noreturn));
15 extern int main(int argc, char *argv[], char **envp);
17 void _start(int argc, char *argv[], char **envp) __attribute__ ((alias("start")));
19 void start(int argc, char *argv[], char **envp)
21 // TODO: isn't this handled by _init?
22 for( int i = 0; _crtbegin_ctors[i]; i ++ )
27 int rv = main(argc, argv, envp);
29 if( _crt0_exit_handler )