gprof's broken in 7-CURRENT

From: Luoqi Chen <Luoqi.Chen_at_brion.com>
Date: Sun, 25 Nov 2007 00:25:48 -0800
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, _at_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
Received on Wed Nov 28 2007 - 02:31:54 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:23 UTC