Changeset View
Changeset View
Standalone View
Standalone View
lib/csu/i386/crt1_c.c
Show All 23 Lines | |||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
* | * | ||||
* $FreeBSD$ | * $FreeBSD$ | ||||
*/ | */ | ||||
#include <sys/cdefs.h> | #include <sys/cdefs.h> | ||||
__FBSDID("$FreeBSD$"); | __FBSDID("$FreeBSD$"); | ||||
#include <stdlib.h> | |||||
#include "libc_private.h" | #include "libc_private.h" | ||||
#include "ignore_init.c" | #include "csu_common.h" | ||||
extern void _start(char *, ...); | void _start(char *, ...); | ||||
#ifdef GCRT | |||||
extern void _mcleanup(void); | |||||
extern void monstartup(void *, void *); | |||||
extern int eprol; | |||||
extern int etext; | |||||
#endif | |||||
void _start1(void (*)(void), int, char *[]) __dead2; | void _start1(void (*)(void), int, char *[]) __dead2; | ||||
/* The entry function, C part. */ | /* The entry function, C part. */ | ||||
void | void | ||||
_start1(void (*cleanup)(void), int argc, char *argv[]) | _start1(void (*cleanup)(void), int argc, char *argv[]) | ||||
{ | { | ||||
char **env; | char **env; | ||||
env = argv + argc + 1; | env = argv + argc + 1; | ||||
handle_argv(argc, argv, env); | |||||
if (&_DYNAMIC != NULL) { | |||||
atexit(cleanup); | |||||
} else { | |||||
process_irelocs(); | |||||
_init_tls(); | |||||
} | |||||
#ifdef GCRT | #ifdef GCRT | ||||
atexit(_mcleanup); | __libc_start1_gcrt(argc, argv, env, cleanup, main, &eprol, &etext); | ||||
monstartup(&eprol, &etext); | |||||
__asm__("eprol:"); | __asm__("eprol:"); | ||||
#else | |||||
__libc_start1(argc, argv, env, cleanup, main); | |||||
#endif | #endif | ||||
handle_static_init(argc, argv, env); | |||||
exit(main(argc, argv, env)); | |||||
} | } | ||||
__asm(".hidden _start1"); | __asm(".hidden _start1"); |