diff options
Diffstat (limited to 'gnu/usr.bin/gcc/config/i386/gmon-sol2.c')
-rw-r--r-- | gnu/usr.bin/gcc/config/i386/gmon-sol2.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/gnu/usr.bin/gcc/config/i386/gmon-sol2.c b/gnu/usr.bin/gcc/config/i386/gmon-sol2.c index c0743958f90..35ac1c9abb7 100644 --- a/gnu/usr.bin/gcc/config/i386/gmon-sol2.c +++ b/gnu/usr.bin/gcc/config/i386/gmon-sol2.c @@ -31,23 +31,18 @@ * SUCH DAMAGE. */ -/* - * Re rework of the solaris 2 version of gmon by J.W.Hawtin 12/8/1996 - * Does not work right yet. - */ - /* - * This is a modified gmon.c by J.W.Hawtin <J.W.Hawtin@lboro.ac.uk>, + * This is a modified gmon.c by J.W.Hawtin <oolon@ankh.org>, * 14/8/96 based on the original gmon.c in GCC and the hacked version * solaris 2 sparc version (config/sparc/gmon-sol.c) by Mark Eichin. To do - * process profiling on solaris 2.4 X86 + * process profiling on solaris 2.X X86 * * It must be used in conjunction with sol2-gc1.asm, which is used to start * and stop process monitoring. * * Differences. * - * On Solaris 2 _mcount is called my library functions not mcount, so support + * On Solaris 2 _mcount is called by library functions not mcount, so support * has been added for both. * * Also the prototype for profil() is different @@ -264,6 +259,7 @@ internal_mcount() register struct tostruct *top; register struct tostruct *prevtop; register long toindex; + static char already_setup; /* * find the return address for mcount, @@ -277,6 +273,17 @@ internal_mcount() This identifies the caller of the function just entered. */ frompcindex = (void *) __builtin_return_address (1); + if(!already_setup) { + extern etext(); + already_setup = 1; +/* monstartup(0, etext); */ + monstartup(0x08040000, etext); +#ifdef USE_ONEXIT + on_exit(_mcleanup, 0); +#else + atexit(_mcleanup); +#endif + } /* * check that we are profiling * and that we aren't recursively invoked. |