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: David Daney <ddaney at caviumnetworks dot com>
- To: Linus Torvalds <torvalds at linux-foundation dot org>
- Cc: Andrew Haley <aph at redhat dot com>, Richard Guenther <richard dot guenther at gmail dot com>, rostedt at goodmis dot org, 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, Fr??d??ric Weisbecker <fweisbec at gmail 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 11:10:35 -0800
- Subject: Re: BUG: GCC-4.4.x changes the function frame on some functions
- References: <alpine.LFD.2.00.0911181933540.24119@localhost.localdomain> <tip-887a29f59b93cf54e21814869a4ab6e80b6fa623@git.kernel.org> <20091119072040.GA23579@elte.hu> <alpine.LFD.2.00.0911191053390.24119@localhost.localdomain> <alpine.LFD.2.00.0911191423190.24119@localhost.localdomain> <alpine.LFD.2.00.0911191607440.24119@localhost.localdomain> <alpine.LFD.2.00.0911190934070.2793@localhost.localdomain> <1258653562.22249.682.camel@gandalf.stny.rr.com> <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>
Linus Torvalds wrote:
On Thu, 19 Nov 2009, Linus Torvalds wrote:
I bet other people than just the kernel use the mcount hook for subtler
things than just doing profiles. And even if they don't, the quoted code
generation is just crazy _crap_.
For the kernel, if the only case is that timer_stat.c thing that Thomas
pointed at, I guess we can at least work around it with something like the
appended. The kernel code is certainly ugly too, no question about that.
It's just that we'd like to be able to depend on mcount code generation
not being insane even in the presense of ugly code..
The alternative would be to have some warning when this happens, so that
we can at least see it. "mcount won't work reliably"
For the MIPS port of GCC and Linux I recently added the
-mmcount-ra-address switch. It causes the location of the return
address (on the stack) to be passed to mcount in a scratch register.
Perhaps something similar could be done for x86. It would make this
patching of the return location more reliable at the expense of more
code at the mcount invocation site.
For the MIPS case the code size doesn't increase, as it is done in the
delay slot of the call instruction, which would otherwise be a nop.
David Daney