On Mon, 27 Jul 2009 02:05:48 +0300
Mart Raudsepp <l...@gentoo.org> wrote:

> On Fri, 2009-07-24 at 12:04 +0300, Samuli Suominen wrote:
> > Would it be OK if I change
> > 
> > [-    ] profile - Adds support for software performance analysis (will
> > likely vary from ebuild to ebuild)
> > 
> > To
> > 
> > [-    ] profile - Adds support for software performance analysis
> > (WARNING: DON'T ENABLE UNLESS YOU KNOW WHAT YOU ARE DOING.)
> > 
> > Or something similar? Suggestions welcome. People seem to add it
> > randomly in combination with -fomit-frame-pointer which breaks with -pg
> > as expected.
> 
> Note that -fomit-frame-pointer is the default with stable gcc (4.3 at
> least) on many architectures - some of those that can still debug with
> gdb without frame pointers thanks to location lists generated to debug
> sections by default with -g on those platforms. This includes at least
> amd64, and I believe x86.

For x86/amd64 -fomit-frame-pointer is enabled at -O1 and higher only if
TARGET_64BIT is true.  Not sure about other archs but you can check with
something like...

dirtye...@halo ~ $ echo "int main() { return 0; }" > test.c
dirtye...@halo ~ $ gcc -c test.c -Q -O2 --help=optimizers | grep fomit
  -fomit-frame-pointer                  [enabled]

> However it might not default enable in combination with -pg, not sure
> about that. Lets say this is a call for testing that, as combinatory
> CFLAGS enabling -fomit-frame-pointer is your reasoning here.

FRAME_POINTER_REQUIRED is defined when profiling is enabled, so
-fomit-frame-pointer by default will be disabled.  If -fomit-frame-pointer
and -pg are both explicitly given on the command line it's an error.

I think the best practise is to strip -fomit-frame-pointer when USE=profile.
Pretty much everyone has it in their CFLAGS (useful or not), and relatively
few packages have the option of building with profiling info. Adding a
warning wouldn't hurt anything though.  Or just change the description to
something that doesn't sound as cool.  "Build with extra debugging
information for code coverage and branch analysis." or something.


-- 
gcc-porting,                      Character is what you are in the dark.
treecleaner,
wxwidgets @ gentoo     EFFD 380E 047A 4B51 D2BD C64F 8AA8 8346 F9A4 0662

Attachment: signature.asc
Description: PGP signature

Reply via email to