From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13699 invoked by alias); 13 Aug 2006 09:43:36 -0000 Received: (qmail 13666 invoked by uid 22791); 13 Aug 2006 09:43:35 -0000 X-Spam-Check-By: sourceware.org Received: from ns.suse.de (HELO mx1.suse.de) (195.135.220.2) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sun, 13 Aug 2006 10:43:33 +0100 Received: from Relay1.suse.de (mail2.suse.de [195.135.221.8]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.suse.de (Postfix) with ESMTP id 3910F1010A; Sun, 13 Aug 2006 11:43:30 +0200 (CEST) From: Andreas Schwab To: Steven Munroe Cc: libc-hacker@sources.redhat.com, Alan Modra Subject: Re: [PATCH] PPC32 cfi update part3 References: <43BC618A.1000006@us.ibm.com> X-Yow: The fact that 47 PEOPLE are yelling and sweat is cascading down my SPINAL COLUMN is fairly enjoyable!! Date: Sun, 13 Aug 2006 09:43:00 -0000 In-Reply-To: (Andreas Schwab's message of "Sun, 13 Aug 2006 10:15:03 +0200") Message-ID: User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Mailing-List: contact libc-hacker-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-hacker-owner@sourceware.org X-SW-Source: 2006-08/txt/msg00017.txt.bz2 Andreas Schwab writes: > Steven Munroe writes: > >> * sysdeps/powerpc/powerpc32/dl-trampoline.S (_dl_runtime_resolve, >> _dl_profile_resolve): Add CFI directives for stack and LR save. >> Save LR in LRSAVE of previous frame per ABI. > > This breaks profiling. The caller of _mcount is supposed to store LR in > LRSAVE, and _mcount restores it from there, but LRSAVE gets clobbered by > the trampoline. Here is a patch that unbreaks it. Andreas. 2006-08-13 Andreas Schwab * sysdeps/powerpc/powerpc32/dl-trampoline.S (_dl_runtime_resolve): Don't clobber caller's LRSAVE. (_dl_prof_resolve): Likewise. --- sysdeps/powerpc/powerpc32/dl-trampoline.S 22 Jan 2006 13:45:52 +0100 1.5 +++ sysdeps/powerpc/powerpc32/dl-trampoline.S 13 Aug 2006 10:31:04 +0200 @@ -40,8 +40,9 @@ _dl_runtime_resolve: mflr r0 # We also need to save some of the condition register fields stw r7,32(r1) - stw r0,68(r1) - cfi_offset (lr, 4) + # Don't clobber the caller's LRSAVE, it is needed by _mcount. + stw r0,48(r1) + cfi_offset (lr, -16) stw r8,36(r1) mfcr r0 stw r9,40(r1) @@ -51,7 +52,7 @@ _dl_runtime_resolve: # 'fixup' returns the address we want to branch to. mtctr r3 # Put the registers back... - lwz r0,68(r1) + lwz r0,48(r1) lwz r10,44(r1) lwz r9,40(r1) mtlr r0 @@ -128,8 +129,9 @@ _dl_prof_resolve: mflr r5 # We also need to save some of the condition register fields. stw r7,32(r1) - stw r5,324(r1) - cfi_offset (lr, 4) + # Don't clobber the caller's LRSAVE, it is needed by _mcount. + stw r5,308(r1) + cfi_offset (lr, -12) stw r8,36(r1) mfcr r0 stw r9,40(r1) @@ -154,7 +156,7 @@ _dl_prof_resolve: # 'fixup' returns the address we want to branch to. mtctr r3 # Put the registers back... - lwz r0,324(r1) + lwz r0,308(r1) lwz r10,44(r1) lwz r9,40(r1) mtlr r0 -- Andreas Schwab, SuSE Labs, schwab@suse.de SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."