Date: Sun, 25 Nov 2007 00:25:48 -0800 From: "Luoqi Chen" <Luoqi.Chen@brion.com> To: <current@freebsd.org> Subject: gprof's broken in 7-CURRENT Message-ID: <336D7181C830FF4E8B176A94FFB3F8D8584740@ex01.briontech.com>
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?336D7181C830FF4E8B176A94FFB3F8D8584740>