This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: BUG: GCC-4.4.x changes the function frame on some functions
- From: Frederic Weisbecker <fweisbec at gmail dot com>
- To: Steven Rostedt <rostedt at goodmis dot org>
- Cc: David Daney <ddaney at caviumnetworks dot com>, Linus Torvalds <torvalds at linux-foundation dot org>, Andrew Haley <aph at redhat dot com>, Richard Guenther <richard dot guenther at gmail dot com>, Thomas Gleixner <tglx at linutronix dot de>, Ingo Molnar <mingo at elte dot hu>, "H. Peter Anvin" <hpa at zytor dot com>, LKML <linux-kernel at vger dot kernel dot org>, Andrew Morton <akpm at linux-foundation dot org>, Heiko Carstens <heiko dot carstens at de dot ibm dot com>, feng dot tang at intel dot com, Peter Zijlstra <peterz at infradead dot org>, jakub at redhat dot com, gcc at gcc dot gnu dot org
- Date: Thu, 19 Nov 2009 21:28:48 +0100
- Subject: Re: BUG: GCC-4.4.x changes the function frame on some functions
- References: <84fc9c000911191003t244eb864o3d5b355ab5485f@mail.gmail.com> <4B058CCD.8050605@redhat.com> <alpine.LFD.2.00.0911191039470.2793@localhost.localdomain> <alpine.LFD.2.00.0911191041471.2793@localhost.localdomain> <alpine.LFD.2.00.0911191047350.2793@localhost.localdomain> <4B05982B.6060200@caviumnetworks.com> <1258658886.22249.874.camel@gandalf.stny.rr.com> <20091119194625.GE4967@nowhere> <1258661141.22249.962.camel@gandalf.stny.rr.com> <1258661836.22249.995.camel@gandalf.stny.rr.com>
On Thu, Nov 19, 2009 at 03:17:16PM -0500, Steven Rostedt wrote:
> On Thu, 2009-11-19 at 15:05 -0500, Steven Rostedt wrote:
>
> > Well, other archs use a register to store the return address. But it
> > would also be easy to do (pseudo arch assembly):
> >
> > <function>:
> > mov lr, (%sp)
> > add 8, %sp
> > blr __fentry__
>
> Should be bl __fentry__ for "branch and link".
>
> > sub 8, %sp
> > mov (%sp), lr
> >
> >
> > That way the lr would have the current function, and the parent would
> > still be at 8(%sp)
>
> Actually, if we add a new profiler and can make our own specification, I
> would say that the add and sub lines be the responsibility of
> __fentry__. Then we would have:
>
> <function>:
> mov lr, (%sp)
> bl __fentry__
> mov (%sp), lr
>
> If sp points to the current content, then replace (%sp) above with
> -8(%sp). Then the implementation of a nop __fentry__ would simply be:
>
> __fentry__:
> blr
Good point!
> For anything more elaborate, __fentry__ would be responsible for all
> adjustments.
Yep. The more we control it from __fentry__, the less we fall
down into unexpected surprises.