linux-mips
[Top] [All Lists]

PATCH: missing call-graph data and profiling

To: linux-mips@oss.sgi.com
Subject: PATCH: missing call-graph data and profiling
From: Simon Gee <simong@oz.agile.tv>
Date: Mon, 13 Aug 2001 13:55:21 +1000
Organization: AgileTV Corporation Australia
Sender: owner-linux-mips@oss.sgi.com
When attempting to use profiling under mips-linux the produced gmon.out
file was reported as "missing call -raph data". The problem lay in the
fact that the following from machine-gmon.h:

        "move $5,$31;" \
        "jal __mcount;" \
        "move $4,$1;" \

was assembled as:

0x432458 <_mcount+40>: move $a1,$ra
0x43245c <_mcount+44>: lw $t9,-32724($gp)
0x432460 <_mcount+48>: nop
0x432464 <_mcount+52>: addiu $t9,$t9,8816
0x432468 <_mcount+56>: jalr $t9
0x43246c <_mcount+60>: nop
0x432470 <_mcount+64>: lw $gp,0($s8)
0x432474 <_mcount+68>: move $a0,$at

by gas. Basically, the fact that "jal __mcount" was being expanded
forced "move $4,$1;" out of the delay slot which resulted in the first
argument to __mcount to be incorrect. The following patch against glibc
corrects this problem.

*** sysdeps/mips/machine-gmon.h.orig    Mon Aug 13 12:17:39 2001
--- sysdeps/mips/machine-gmon.h Mon Aug 13 12:18:00 2001
***************
*** 43,50 ****
          "sw $1,16($29);" \
          "sw $31,20($29);" \
          "move $5,$31;" \
-         "jal __mcount;" \
          "move $4,$1;" \
          "lw $4,24($29);" \
          "lw $5,28($29);" \
          "lw $6,32($29);" \
--- 43,51 ----
          "sw $1,16($29);" \
          "sw $31,20($29);" \
          "move $5,$31;" \
          "move $4,$1;" \
+         "jal __mcount;" \
+         "nop;" \
          "lw $4,24($29);" \
          "lw $5,28($29);" \
          "lw $6,32($29);" \

Simon




<Prev in Thread] Current Thread [Next in Thread>