2000-02-18 03:38:33 +08:00
|
|
|
/* gcrt0.c
|
|
|
|
|
2013-06-18 17:45:37 +08:00
|
|
|
Copyright 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
|
2000-02-18 03:38:33 +08:00
|
|
|
|
|
|
|
This file is part of Cygwin.
|
|
|
|
|
|
|
|
This software is a copyrighted work licensed under the terms of the
|
|
|
|
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
|
|
|
|
details. */
|
|
|
|
|
2013-06-18 17:45:37 +08:00
|
|
|
/*
|
|
|
|
* This file is taken from Cygwin distribution. Please keep it in sync.
|
|
|
|
* The differences should be within __MINGW32__ guard.
|
|
|
|
*/
|
|
|
|
|
2000-02-18 03:38:33 +08:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
2013-06-18 17:45:37 +08:00
|
|
|
#ifdef __MINGW32__
|
|
|
|
#include <_bsd_types.h>
|
|
|
|
#endif
|
|
|
|
|
2016-03-24 23:39:15 +08:00
|
|
|
extern uint8_t etext asm ("etext");
|
|
|
|
extern uint8_t eprol asm ("__eprol");
|
2000-02-18 03:38:33 +08:00
|
|
|
extern void _mcleanup (void);
|
2013-06-18 17:45:37 +08:00
|
|
|
extern void monstartup (size_t, size_t);
|
2001-03-12 00:46:28 +08:00
|
|
|
void _monstartup (void) __attribute__((__constructor__));
|
2000-02-18 03:38:33 +08:00
|
|
|
|
|
|
|
/* startup initialization for -pg support */
|
|
|
|
|
|
|
|
void
|
|
|
|
_monstartup (void)
|
|
|
|
{
|
|
|
|
static int called;
|
|
|
|
|
|
|
|
/* Guard against multiple calls that may happen if DLLs are linked
|
|
|
|
with profile option set as well. Addede side benefit is that it
|
|
|
|
makes profiling backward compatible (GCC used to emit a call to
|
|
|
|
_monstartup when compiling main with profiling enabled). */
|
|
|
|
if (called++)
|
|
|
|
return;
|
|
|
|
|
2013-06-18 17:45:37 +08:00
|
|
|
monstartup ((size_t) &eprol, (size_t) &etext);
|
2000-02-18 03:38:33 +08:00
|
|
|
atexit (&_mcleanup);
|
|
|
|
}
|
|
|
|
|
|
|
|
asm (".text");
|
|
|
|
asm ("__eprol:");
|
|
|
|
|