Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Architectures & Platforms Gentoo on AMD64
  • Search

-fomit-frame-pointer seems to be impliede in -O > 0 on am

Have an x86-64 problem? Post here.
Locked
Advanced search
5 posts • Page 1 of 1
Author
Message
secondshadow
Guru
Guru
Posts: 362
Joined: Mon Jun 23, 2003 1:06 am

-fomit-frame-pointer seems to be impliede in -O > 0 on am

  • Quote

Post by secondshadow » Wed Mar 03, 2004 4:28 am

So an interesting subject came up in the #gentoo-amd64 room on freenode tonight. I thought that -fomit-frame-pointer was implied in -O3... but brad seemed to think that this was not the case...and the documentation on gcc.gnu.org is a bit ambiguious on this point as it says that -fomit-frame-pointer in -O, -O2, -O3, and -Os. But elsewhere it stated that it was only enabled in certain archs...so we were a bit confused. I decided to do some testing. First I wrote a simple hello world program.

Code: Select all

#include <stdio.h>
int main()
{
	printf("Hello World\n");
	return 1;
}
This was compiled a number of times....starting with gcc -O3 working down...though there are really only 4 builds that were relavent:

for Comparison #1
gcc -O0 hello.c
gcc -O0 -fomit-frame-pointer hello.c


for Comparison #2
gcc -O1 hello.c
gcc -O1 -fomit-frame-pointer hello.c


What I found was that in comparison #1 the binaries generated differed, which was to be expected. What was somewhat surprising is that in comparison #2 they did not differ. This was surprising to me because (supposedly) in the 32-bit x86 arch -fomit-frame-pointer is NOT implied by optimization and must be explicitly used...again...supposedly. Just to be safe, however, I tried a slightly more complex program:

Code: Select all

#include <stdio.h>

int main()
{
	FILE *infile;
	FILE *outfile;
	unsigned char byte;
	infile=fopen("copy.c","r");
	outfile=fopen("copied.c","r");
	byte=fgetc(infile);
	while(!feof(infile))
	{
		fputc(byte,outfile);
		byte=fgetc(infile);
	}
	fclose(infile);
	fclose(outfile);
	return 1;
}
Again, the results were the same, so in short, if appears that I can now reduce my CFLAGS from: "-O3 -pipe -fomit-frame-pointer" to "-O3 -pipe".

I just thought that the community might be interested in this, if for not other reason than, if you are going to emerge something but you want to keep that pesky frame-pointer around for debugging purposes then perhaps using -fnoomit-frame-pointer would be called for.
Top
thumper
Guru
Guru
User avatar
Posts: 555
Joined: Fri Dec 06, 2002 2:58 am
Location: Venice FL

  • Quote

Post by thumper » Thu Mar 04, 2004 7:41 pm

According to this it's implied by -O1

Interesting read:
http://www.coyotegulch.com/acovea/


George
Top
secondshadow
Guru
Guru
Posts: 362
Joined: Mon Jun 23, 2003 1:06 am

  • Quote

Post by secondshadow » Fri Mar 05, 2004 1:24 am

Yup...I thought that was clear when I said -O > 0....'cause -O0 means no optimizations... :D

EDIT: Oh and supposedly -fomit-frame-pointer should NOT be turned on EVER by default on the x86 arch as it makes it nearly impossible to debug anything....though I should probably check on that
Top
thumper
Guru
Guru
User avatar
Posts: 555
Joined: Fri Dec 06, 2002 2:58 am
Location: Venice FL

  • Quote

Post by thumper » Fri Mar 05, 2004 1:49 am

I was under the impression that x86 does not enable the flag by default, or so the gcc docs imply.

Anyway, I saw that document, though you might enjoy the read. :)

George
Top
secondshadow
Guru
Guru
Posts: 362
Joined: Mon Jun 23, 2003 1:06 am

  • Quote

Post by secondshadow » Fri Mar 05, 2004 3:41 am

yeah, I've read it. It was cool...I just assumed that since x86_64 is an extension of x86 that -fomit-frame-pointer would be turned off in it as well......very odd IMO...
Top
Locked

5 posts • Page 1 of 1

Return to “Gentoo on AMD64”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Authors
Gentoo is a trademark of the Gentoo Foundation, Inc. and of Förderverein Gentoo e.V.
The contents of this document, unless otherwise expressly stated, are licensed under the CC-BY-SA-4.0 license.
The Gentoo Name and Logo Usage Guidelines apply.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy