Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/winsup
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2011-02-14 12:42:19 +0300
committerCorinna Vinschen <corinna@vinschen.de>2011-02-14 12:42:19 +0300
commit4655360348c02af0f2be963fcaf23d4916ceb0dd (patch)
tree28acae7b2593359057129820a128f6a3291ecd7c /winsup
parent6148be0f229913f22a8e3681320055b986ce4e83 (diff)
* config/i386/profile.h: Sync with Mingw.
Diffstat (limited to 'winsup')
-rw-r--r--winsup/cygwin/ChangeLog4
-rw-r--r--winsup/cygwin/config/i386/profile.h35
2 files changed, 34 insertions, 5 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index afd9cd1e9..92f27154a 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -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>
* path.cc (struct _FAST_CWD): Redefine to new layout used since patch
diff --git a/winsup/cygwin/config/i386/profile.h b/winsup/cygwin/config/i386/profile.h
index 748b89aa0..d1de0f98e 100644
--- a/winsup/cygwin/config/i386/profile.h
+++ b/winsup/cygwin/config/i386/profile.h
@@ -35,24 +35,49 @@
* @(#)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 \
void \
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, \
* and the return address for mcount's caller. \
* \
* 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. \
*/ \
- __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); \
+ /* \
+ * Restore registers. \
+ */ \
+ __asm __volatile__ ("popl %edx\n\t" \
+ "popl %ecx\n\t" \
+ "popl %eax"); \
}
-