diff options
Diffstat (limited to 'lib/csu/i386-elf/crt1_c.c')
-rw-r--r-- | lib/csu/i386-elf/crt1_c.c | 27 |
1 files changed, 6 insertions, 21 deletions
diff --git a/lib/csu/i386-elf/crt1_c.c b/lib/csu/i386-elf/crt1_c.c index 1eadc7c..3249069 100644 --- a/lib/csu/i386-elf/crt1_c.c +++ b/lib/csu/i386-elf/crt1_c.c @@ -39,15 +39,10 @@ __FBSDID("$FreeBSD$"); #include "libc_private.h" #include "crtbrand.c" - -extern int _DYNAMIC; -#pragma weak _DYNAMIC +#include "ignore_init.c" typedef void (*fptr)(void); -extern void _fini(void); -extern void _init(void); -extern int main(int, char **, char **); extern void _start(char *, ...); #ifdef GCRT @@ -57,9 +52,6 @@ extern int eprol; extern int etext; #endif -char **environ; -const char *__progname = ""; - void _start1(fptr, int, char *[]) __dead2; /* The entry function, C part. */ @@ -67,16 +59,11 @@ void _start1(fptr cleanup, int argc, char *argv[]) { char **env; - const char *s; env = argv + argc + 1; environ = env; - if (argc > 0 && argv[0] != NULL) { - __progname = argv[0]; - for (s = __progname; *s != '\0'; s++) - if (*s == '/') - __progname = s + 1; - } + if (argc > 0 && argv[0] != NULL) + handle_progname(argv[0]); if (&_DYNAMIC != NULL) atexit(cleanup); @@ -85,14 +72,12 @@ _start1(fptr cleanup, int argc, char *argv[]) #ifdef GCRT atexit(_mcleanup); -#endif - atexit(_fini); -#ifdef GCRT monstartup(&eprol, &etext); __asm__("eprol:"); #endif - _init(); - exit( main(argc, argv, env) ); + + handle_static_init(argc, argv, env); + exit(main(argc, argv, env)); } __asm(".hidden _start1"); |