* config/i386/profile.h: Sync with Mingw.
This commit is contained in:
parent
6148be0f22
commit
4655360348
|
@ -1,3 +1,7 @@
|
||||||
|
2011-02-14 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* config/i386/profile.h: Sync with Mingw.
|
||||||
|
|
||||||
2011-02-13 Corinna Vinschen <corinna@vinschen.de>
|
2011-02-13 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* path.cc (struct _FAST_CWD): Redefine to new layout used since patch
|
* path.cc (struct _FAST_CWD): Redefine to new layout used since patch
|
||||||
|
|
|
@ -35,24 +35,49 @@
|
||||||
* @(#)profile.h 8.1 (Berkeley) 6/11/93
|
* @(#)profile.h 8.1 (Berkeley) 6/11/93
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define _MCOUNT_DECL static inline void _mcount
|
/*
|
||||||
|
* This file is taken from Cygwin distribution. Please keep it in sync.
|
||||||
|
* 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 \
|
#define MCOUNT \
|
||||||
void \
|
void \
|
||||||
mcount() \
|
mcount() \
|
||||||
{ \
|
{ \
|
||||||
int selfpc, frompcindex; \
|
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, \
|
* find the return address for mcount, \
|
||||||
* and the return address for mcount's caller. \
|
* and the return address for mcount's caller. \
|
||||||
* \
|
* \
|
||||||
* selfpc = pc pushed by mcount call \
|
* selfpc = pc pushed by mcount call \
|
||||||
*/ \
|
*/ \
|
||||||
__asm __volatile ("movl 4(%%ebp),%0" : "=r" (selfpc)); \
|
/* __asm ("movl 4(%%ebp),%0" : "=r" (selfpc)); */ \
|
||||||
|
selfpc = (u_long) __builtin_return_address (0); \
|
||||||
/* \
|
/* \
|
||||||
* frompcindex = pc pushed by call into self. \
|
* frompcindex = pc pushed by call into self. \
|
||||||
*/ \
|
*/ \
|
||||||
__asm __volatile ("movl (%%ebp),%0;movl 4(%0),%0" : "=r" (frompcindex));\
|
/* __asm ("movl (%%ebp),%0;movl 4(%0),%0" : "=r" (frompcindex)); */ \
|
||||||
|
frompcindex = (u_long) __builtin_return_address (1); \
|
||||||
_mcount(frompcindex, selfpc); \
|
_mcount(frompcindex, selfpc); \
|
||||||
|
/* \
|
||||||
|
* Restore registers. \
|
||||||
|
*/ \
|
||||||
|
__asm __volatile__ ("popl %edx\n\t" \
|
||||||
|
"popl %ecx\n\t" \
|
||||||
|
"popl %eax"); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue