Date: Sun, 25 Nov 2007 13:54:22 -0800 (PST) From: Luoqi Chen <luoqi@luoqi.homeunix.org> To: current@freebsd.org Subject: gprof's broken in 7-CURRENT Message-ID: <200711252154.lAPLsMXb003966@luoqi.homeunix.org>
next in thread | raw e-mail | index | archive | help
Has anyone else noticed that gprof no longer works with gcc 4.2 compiled code? It has something to do with forced stack alignment. Here's the cc -O -S output of this piece of code: int main(int argc, char **argv) { if (argc < 2) exit(1); } .globl main .type main, @function main: leal 4(%esp), %ecx andl $-16, %esp pushl -4(%ecx) pushl %ebp movl %esp, %ebp subl $56, %esp movl %ecx, -16(%ebp) movl %ebx, -12(%ebp) movl %esi, -8(%ebp) movl %edi, -4(%ebp) call .mcount movl 4(%ecx), %edi cmpl $2, (%ecx) jg .L83 movl $1, (%esp) call exit .p2align 4,,7 .L83: Register %ecx becomes the new ap after the forced stack alignment, however it is not preserved by .mcount. We can work around this problem by preserving ecx in mcount, but a better solution would be to fix gcc instead. -lq
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200711252154.lAPLsMXb003966>