OSDN Git Service

* profile/profile.h (mcount): Use __builtin_return_address
authordannysmith <dannysmith>
Sun, 16 Mar 2003 22:12:00 +0000 (22:12 +0000)
committerdannysmith <dannysmith>
Sun, 16 Mar 2003 22:12:00 +0000 (22:12 +0000)
rather than __asm statements.
* profile/Makefile.in: Remove special rule for mcount.o
Specify dependencies for mcount.o profil.o gmon.o.

winsup/mingw/ChangeLog
winsup/mingw/profile/Makefile.in
winsup/mingw/profile/profile.h

index 323ac68..fe9068b 100644 (file)
@@ -1,3 +1,10 @@
+2003-03-16  Danny Smith  <dannysmith@users.sourceforge.net>
+
+       * profile/profile.h (mcount): Use __builtin_return_address
+       rather than inline __asm statements.
+       * profile/Makefile.in: Remove special rule for mcount.o
+       Specify dependencies for mcount.o profil.o gmon.o.
+
 2003-03-10  Danny Smith  <dannysmith@users.sourceforge.net>
 
        * include/stdlib.h (qsort): Remove const from first parm.
index f18bfe4..aca3a29 100644 (file)
@@ -89,10 +89,12 @@ gcrt1.o: gcrt0.c
 gcrt2.o: gcrt0.c
        $(CC) -D__MSVCRT__ -c -o $@ $(CPPFLAGS) $(CFLAGS) $?
 
-#FIXME: Optimizing at higher than -O1 tweaks a bug in gcc 3.2.2
-# and earlier
-mcount.o: mcount.c
-       $(CC)  -D__MSVCRT__ -c -o $@ $(CPPFLAGS) ${filter-out -O%,$(ALL_CFLAGS)} -O1 $?
+#
+# Dependancies
+#
+gmon.o: gmon.c gmon.h profile.h profil.h
+mcount.o: mcount.c gmon.h profile.h
+profil.o: profil.c profil.h
 
 Makefile: Makefile.in config.status configure
        $(SHELL) config.status
@@ -137,3 +139,4 @@ dist:
        @for i in $(DISTFILES); do\
                cp -p $(srcdir)/$$i $(distdir)/profile/$$i ; \
        done
+
index d578657..6c198d7 100644 (file)
 void                                                                   \
 mcount()                                                               \
 {                                                                      \
-       int selfpc, frompcindex;                                        \
+        u_long selfpc, frompcindex;                                    \
        /*                                                              \
         * find the return address for mcount,                          \
         * and the return address for mcount's caller.                  \
         *                                                              \
         * selfpc = pc pushed by mcount call                            \
         */                                                             \
-       __asm("movl 4(%%ebp),%0" : "=r" (selfpc));                      \
+       /* __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));    \
+       /* __asm ("movl (%%ebp),%0;movl 4(%0),%0" : "=r" (frompcindex)); */     \
+       frompcindex = (u_long) __builtin_return_address (1);            \
        _mcount(frompcindex, selfpc);                                   \
 }