From owner-freebsd-current@FreeBSD.ORG Wed Nov 28 03:31:54 2007 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 54BB816A420 for ; Wed, 28 Nov 2007 03:31:54 +0000 (UTC) (envelope-from Luoqi.Chen@brion.com) Received: from mail.brion.com (mail.brion.com [66.134.244.226]) by mx1.freebsd.org (Postfix) with ESMTP id 3FB9713C459 for ; Wed, 28 Nov 2007 03:31:54 +0000 (UTC) (envelope-from Luoqi.Chen@brion.com) Received: by mail.brion.com (Postfix, from userid 130) id 29658D808E; Sun, 25 Nov 2007 00:25:01 -0800 (PST) Received: from exmail.briontech.com (ex01.briontech.com [192.168.1.10]) by mail.brion.com (Postfix) with ESMTP id 202D4D8088 for ; Sun, 25 Nov 2007 00:24:58 -0800 (PST) X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Date: Sun, 25 Nov 2007 00:25:48 -0800 Message-ID: <336D7181C830FF4E8B176A94FFB3F8D8584740@ex01.briontech.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: gprof's broken in 7-CURRENT Thread-Index: AcgvPMgRl43J5nYpT1anCLQcUxwo7Q== From: "Luoqi Chen" To: X-Mailman-Approved-At: Wed, 28 Nov 2007 04:54:15 +0000 Cc: Subject: gprof's broken in 7-CURRENT X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Nov 2007 03:31:54 -0000 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