From owner-freebsd-current@FreeBSD.ORG Wed Nov 28 23:22:50 2007 Return-Path: Delivered-To: current@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 85E3116A421; Wed, 28 Nov 2007 23:22:50 +0000 (UTC) (envelope-from luoqi@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 8937413C43E; Wed, 28 Nov 2007 23:22:45 +0000 (UTC) (envelope-from luoqi@FreeBSD.org) Received: from freefall.freebsd.org (luoqi@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id lASNMjHv014323; Wed, 28 Nov 2007 23:22:45 GMT (envelope-from luoqi@freefall.freebsd.org) Received: (from luoqi@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id lASNMjNu014322; Wed, 28 Nov 2007 23:22:45 GMT (envelope-from luoqi) Date: Wed, 28 Nov 2007 23:22:45 GMT From: Luoqi Chen Message-Id: <200711282322.lASNMjNu014322@freefall.freebsd.org> To: current@FreeBSD.org, ivoras@FreeBSD.org Cc: Subject: RE: 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 23:22:50 -0000 > Luoqi Chen wrote: > > Has anyone else noticed that gprof no longer works with gcc 4.2 > > It's a known bug (very irritating!), but I think noone is working on it > so it won't be fixed in 7.0. In that case, I'll fix it. I've looked at glibc's code, it claims that mcount cannot clobber any register. I don't know if there is a standard for mcount interface, but I guess the gcc team would use the glibc implementation as the reference. I'll change our code to do the same. /* We need a special version of the `mcount' function since for ix86 it must not clobber any register. This has several reasons: - there is a bug in gcc as of version 2.7.2.2 which prohibits the use of profiling together with nested functions - the ELF `fixup' function uses GCC's regparm feature - some (future) systems might want to pass parameters in registers. */ ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(_mcount) ASM_TYPE_DIRECTIVE(C_SYMBOL_NAME(_mcount), @function) .align ALIGNARG(4) C_LABEL(_mcount) /* Save the caller-clobbered registers. */ pushl %eax pushl %ecx pushl %edx movl 12(%esp), %edx movl 4(%ebp), %eax /* No need to access the PLT or GOT, __mcount_internal is an internal function and we can make a relative call. */ call C_SYMBOL_NAME(__mcount_internal) /* Pop the saved registers. Please note that `mcount' has no return value. */ popl %edx popl %ecx popl %eax ret ASM_SIZE_DIRECTIVE(C_SYMBOL_NAME(_mcount)) Thanks -lq