PATCH: missing call-graph data and profiling
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,$ra0x43245c <_mcount+44>: lw $t9,-32724($gp)0x432460 <_mcount+48>: nop0x432464 <_mcount+52>: addiu $t9,$t9,88160x432468 <_mcount+56>: jalr $t90x43246c <_mcount+60>: nop0x432470 <_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
Thanks, I've committed this to the CVS archive. Please send glibc patches next time to the glibc mailing list,
Andreas
Signature · 4 lines
Andreas Jaeger SuSE Labs [email protected] private [email protected] http://www.suse.de/~aj