------- Comment #3 from bennett dot schneider at yahoo dot com  2009-07-30 
13:06 -------
internal_mcount's from and self arguments were reversed from glibc's version. 
Here's the full diff of gmon-sol2.c that produces correct output:
--- gcc/config/i386/gmon-sol2.c.orig    Wed Jul 29 08:57:15 2009
+++ gcc/config/i386/gmon-sol2.c Thu Jul 30 07:53:16 2009
@@ -66,7 +66,7 @@
 extern void _mcleanup (void);
 extern void internal_mcount (
 #ifdef __x86_64__
-                            char *, unsigned short *
+                            unsigned short *, char *
 #else
                             void
 #endif
@@ -266,8 +266,8 @@
     "\tmovq\t%r9,0x30(%rsp)\n"
     /* Get SELFPC (pushed by the call to this function) and
        FROMPCINDEX (via the frame pointer.  */
-    "\tmovq\t0x38(%rsp),%rdi\n"
-    "\tmovq\t0x8(%rbp),%rsi\n"
+    "\tmovq\t0x38(%rsp),%rsi\n"
+    "\tmovq\t0x8(%rbp),%rdi\n"
     "\tcallq\tinternal_mcount\n"
     /* Restore the saved registers.  */
     "\tmovq\t0x30(%rsp),%r9\n"
@@ -275,7 +275,7 @@
     "\tmovq\t0x20(%rsp),%rdi\n"
     "\tmovq\t0x18(%rsp),%rsi\n"
     "\tmovq\t0x10(%rsp),%rdx\n"
-    "\tmovq\t0x08(%rsp),%rdx\n"
+    "\tmovq\t0x08(%rsp),%rcx\n"
     "\tmovq\t(%rsp),%rax\n"
     "\taddq\t$0x38,%rsp\n"
     "\tretq\n"
@@ -290,8 +290,8 @@
 void
 internal_mcount (
 #ifdef __x86_64__
-                char *selfpc,
-                unsigned short *frompcindex
+                unsigned short *frompcindex,
+                char *selfpc
 #else
                 void
 #endif


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38085

Reply via email to