From: Chris S. <ir0...@us...> - 2005-08-12 22:04:32
|
Update of /cvsroot/mingw/runtime/profile In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17105/profile Modified Files: mcount.c profile.h Log Message: Merge Cygwin changes Index: profile.h =================================================================== RCS file: /cvsroot/mingw/runtime/profile/profile.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** profile.h 3 May 2003 13:48:49 -0000 1.2 --- profile.h 12 Aug 2005 22:04:24 -0000 1.3 *************** *** 40,45 **** * The differences should be within __MINGW32__ guard. */ ! #define _MCOUNT_DECL static inline void _mcount #define MCOUNT \ --- 40,51 ---- * The differences should be within __MINGW32__ guard. */ + /* If compiler doesn't inline, at least avoid passing args on the stack. */ + #define _MCOUNT_CALL __attribute__ ((regparm (2))) + #define _MCOUNT_DECL static __inline__ void _MCOUNT_CALL _mcount ! /* FIXME: This works, but it would be cleaner to convert mcount into an ! assembler stub that calls an extern _mcount. ! Older versions of GCC (pre-4.1) will still fail with regparm since the ! compiler used %edx to store an unneeded counter variable. */ #define MCOUNT \ *************** *** 47,51 **** mcount() \ { \ ! u_long selfpc, frompcindex; \ /* \ * find the return address for mcount, \ --- 53,64 ---- mcount() \ { \ ! u_long selfpc, frompcindex; \ ! /* \ ! * Save registers, since this may be called from \ ! * the prologue of a regparm function. \ ! */ \ ! __asm __volatile__ ("pushl %eax\n\t" \ ! "pushl %ecx\n\t" \ ! "pushl %edx"); \ /* \ * find the return address for mcount, \ *************** *** 54,65 **** * selfpc = pc pushed by mcount call \ */ \ ! /* __asm volatile ("movl 4(%%ebp),%0" : "=r" (selfpc)); */ \ selfpc = (u_long) __builtin_return_address (0); \ /* \ * frompcindex = pc pushed by call into self. \ */ \ ! /* __asm ("movl (%%ebp),%0;movl 4(%0),%0" : "=r" (frompcindex)); */ \ frompcindex = (u_long) __builtin_return_address (1); \ _mcount(frompcindex, selfpc); \ } - --- 67,83 ---- * selfpc = pc pushed by mcount call \ */ \ ! /* __asm ("movl 4(%%ebp),%0" : "=r" (selfpc)); */ \ selfpc = (u_long) __builtin_return_address (0); \ /* \ * frompcindex = pc pushed by call into self. \ */ \ ! /* __asm ("movl (%%ebp),%0;movl 4(%0),%0" : "=r" (frompcindex)); */ \ frompcindex = (u_long) __builtin_return_address (1); \ _mcount(frompcindex, selfpc); \ + /* \ + * Restore registers. \ + */ \ + __asm __volatile__ ("popl %edx\n\t" \ + "popl %ecx\n\t" \ + "popl %eax"); \ } Index: mcount.c =================================================================== RCS file: /cvsroot/mingw/runtime/profile/mcount.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** mcount.c 4 Jun 2001 23:26:03 -0000 1.1.1.1 --- mcount.c 12 Aug 2005 22:04:24 -0000 1.2 *************** *** 62,68 **** * perform this optimization. */ ! //_MCOUNT_DECL __P((u_long frompc, u_long selfpc)); ! _MCOUNT_DECL(frompc, selfpc) /* _mcount; may be static, inline, etc */ ! register u_long frompc, selfpc; { register u_short *frompcindex; --- 62,67 ---- * perform this optimization. */ ! /* _mcount; may be static, inline, etc */ ! _MCOUNT_DECL (u_long frompc, u_long selfpc) { register u_short *frompcindex; |