This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH: Turn on -fomit-frame-pointer by default for 32bit Linux/x86


On Tue, Aug 10, 2010 at 8:52 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Sun, Aug 8, 2010 at 7:56 AM, Uros Bizjak <ubizjak@gmail.com> wrote:
>> Hello!
>>
>> After recent discussions, I would like to propose a transition to
>> -fomit-frame-pointer for x86_32.
>>
>> The transition should be smooth as much as possible, should have
>> option to revert to old behaviour and still providing path for the
>> improvement. And we have learned something from cld issues, too
>> (cough, cough...).
>>
>> I support the idea to change x86_32 defaults w.r.t. frame pointer (and
>> unwind tables) to the same defaults as x86_64 has.
>>
>> The patch should also introduce --enable-frame-pointer configure
>> option (off by default) that would revert back to old x86_32
>> behaviour. So, if there are codes that depend on FP, their users (or
>> distributions) should either (re-)configure the compiler with
>> --enable-frame-pointer or they should use older compiler - 4.5.x will
>> still be supported for many years. OTOH, it looks that users don't
>> care that much whether backtraces on x86_64 are totally accurate, so
>> IMO the sky won't fall down if x86_32 misses some backtraces in the
>> same way. And as I have learned from the discussion, the problem is
>> fixable with some effort on the user's side, thus fixing both targets
>> in one shot.
>>
>> Of course, this change and the option to revert to the previous
>> behaviour should be announced and documented in GCC release notes for
>> 4.6.0.
>>
>> IMO, we have to bite the bullet from time to time in order to improve
>> the generated code. We should not claim that gcc is
>> "no-code-left-behind compiler" - from my experience, introducing new
>> compiler always means that some parts of the code have to be fixed (as
>> in case of the change to -fno-strict-aliasing).
>>
>> Uros.
>>
>
> I tested this patch on Linux/ia32 and Linux/x86-64. There are no regressions.
>
> I don't have good wording for document:
>
> --
> For 32-bit x86 targets, it is not enabled at @option{-Os} by default.
> This option also can be disabled by default on 32-bit x86 targets by
> configuring GCC with the @option{--enable-frame-pointer} configure
> option.
> --
>
> isn't very accurate. ?Any suggestions?
>
> Thanks.
>
>
> --
> H.J.
> ---
> 2010-08-09 ?H.J. Lu ?<hongjiu.lu@intel.com>
>
> ? ? ? ?* config.gcc: Handle --enable-frame-pointer.
>
> ? ? ? ?* configure.ac: Add --enable-frame-pointer.
> ? ? ? ?* configure: Regenerated.
>
> ? ? ? ?* config/i386/i386.c (override_options): If not optimize for
> ? ? ? ?size, use -fomit-frame-pointer and -fasynchronous-unwind-tables
> ? ? ? ?by default for 32-bit code unless configured with
> ? ? ? ?--enable-frame-pointer.
>

Here is the updated patch.  Any comments?

Thanks.

-- 
H.J.
--
2010-08-12  H.J. Lu  <hongjiu.lu@intel.com>
	    Uros Bizjak  <ubizjak@gmail.com>

	* config.gcc: Handle --enable-frame-pointer.

	* configure.ac: Add --enable-frame-pointer.
	* configure: Regenerated.

	* config/i386/i386.c (USE_IX86_FRAME_POINTER): Default to 0.
	(override_options): Enable -fomit-frame-pointer for 32bit code
	if compiling for TARGET_MACHO and not optimizing for size
	unless configured with --enable-frame-pointer.  Enable
	-fasynchronous-unwind-tables unless configured with
	--enable-frame-pointer.  Enable -maccumulate-outgoing-args
	by default unless configured with --enable-frame-pointer.

Attachment: gcc-i386-fp-7.patch
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]