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]

Re: Turn on -fomit-frame-pointer by default for 32bit x86?


On 07/16/10 13:35, Andi Kleen wrote:
"H.J. Lu"<hjl.tools@gmail.com> writes:

[hjl@gnu-6 tmp]$ /usr/gcc-4.5/bin/gcc -m32 -S x.c -O3
[hjl@gnu-6 tmp]$ cat x.s
	.file	"x.c"
	.text
.globl foo
	.type	foo, @function
foo:
	pushl	%ebp
	movl	%esp, %ebp
	popl	%ebp
	ret

Can we turn on -fomit-frame-pointer by default for 32bit?
I think it's a good idea, but in general one side effect one should
be aware of is that it breaks many profilers with calltrace per sample
support. Those tend to not be able to read unwind tables.
Speaking of, I sent you a message on fentry about a month ago, but didn't get a reply:

I was ready to commit, except that we get a few new testsuite failures which I think touch on the issue of implicit setting of -fomit-frame-pointer issue.

See:
/* Set the default values for switches whose default depends on TARGET_64BIT
in case they weren't overwritten by command line options. */
if (TARGET_64BIT)
{
/* Mach-O doesn't support omitting the frame pointer for now. */
if (flag_omit_frame_pointer == 2)
flag_omit_frame_pointer = (TARGET_MACHO ? 0 : 1);
if (flag_asynchronous_unwind_tables == 2)
flag_asynchronous_unwind_tables = 1;
if (flag_pcc_struct_return == 2)
flag_pcc_struct_return = 0;
}
else
{
if (flag_omit_frame_pointer == 2)
flag_omit_frame_pointer = 0;
if (flag_asynchronous_unwind_tables == 2)
flag_asynchronous_unwind_tables = 0;
if (flag_pcc_struct_return == 2)
flag_pcc_struct_return = DEFAULT_PCC_STRUCT_RETURN;
}




For x86_64, -fomit-frame-pointer is implicitly set; therefore with your patch someone compiling with -O2 -pg will get a diagnostic informing them those options are incompatible except with -mfentry is added. I don't think you intended to get a diagnostic in this case. It's certainly a behaviour change.

Jeff


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