[patch] fix profiling in glibc for Linux/MIPS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



_mcount was doing awful things to its caller's stack frame.

Theoretically, we can get by with 16 bytes less of stack than I now
allocate, but GCC still considers functions that call _mcount to be leaf
functions, so that doesn't work.  I think this is close enough; it only adds
one instruction.  Is this OK?  Do I need a "nop" after the subu?  My MIPS
assembly knowledge is not that thorough.

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer

--- glibc-2.2.3/sysdeps/mips/machine-gmon.h.orig	Wed Jul 25 20:09:20 2001
+++ glibc-2.2.3/sysdeps/mips/machine-gmon.h	Wed Jul 25 21:14:09 2001
@@ -35,22 +35,23 @@
         ".set noreorder;" \
         ".set noat;" \
         CPLOAD \
-        "sw $4,8($29);" \
-        "sw $5,12($29);" \
-        "sw $6,16($29);" \
-        "sw $7,20($29);" \
-        "sw $1,0($29);" \
-        "sw $31,4($29);" \
+	"subu $29,$29,40;" \
+        "sw $4,24($29);" \
+        "sw $5,28($29);" \
+        "sw $6,32($29);" \
+        "sw $7,36($29);" \
+        "sw $1,16($29);" \
+        "sw $31,20($29);" \
         "move $5,$31;" \
         "jal __mcount;" \
         "move $4,$1;" \
-        "lw $4,8($29);" \
-        "lw $5,12($29);" \
-        "lw $6,16($29);" \
-        "lw $7,20($29);" \
-        "lw $31,4($29);" \
-        "lw $1,0($29);" \
-        "addu $29,$29,8;" \
+        "lw $4,24($29);" \
+        "lw $5,28($29);" \
+        "lw $6,32($29);" \
+        "lw $7,36($29);" \
+        "lw $31,20($29);" \
+        "lw $1,16($29);" \
+        "addu $29,$29,48;" \
         "j $31;" \
         "move $31,$1;" \
         ".set reorder;" \


[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux