FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Gentoo > Gentoo User

 
 
LinkBack Thread Tools
 
Old 11-06-2009, 03:07 PM
 
Default How compatible are the various gcc -O flags?

How compatible are the various gcc optimization flags? Are they
internal to a single program, do they affect library calls? Can some
packages be made with one flag and still work with other packages made
with other flags?

Let me make up some completely fake examples. Suppose -Ox unrolls
loops. I can't see how any other code could ever notice, so it would
be perfectly fine to mix and match packages which have and don't have
this optimization.

Suppose -Oz changes the order of passing parameters on the stack
because someone found a 0.3% speedup if the first parameter was first
instead of last (or vice versa). Quite obviously this would be fatal
for a -Oz package to call a non-Oz package. But suppose this
optimization was only done inside static functions which were not
visible to outside callers -- then it would be ok to mix.

What brings this up is having changed CFLAGS to -O3 some time ago, I
know not why. I found it by accident when a glib emerge made hald
stop working which prevented X from running. Suppose I want to change
this to -Os, or -O2, or -O1, or any of the other optimization flags,
like -fomit-frame-pointer. What flags are incompatible with others?

My gut feeling is that there aren't any such flags, otherwise how
could you ever recompile anything except as cross platform? But then,
maybe certain packages are set to filter certain flags, maybe gcc and
the tool chain do this to isolate themselves from dangerous flags.

--
... _._. ._ ._. . _._. ._. ___ .__ ._. . .__. ._ .. ._.
Felix Finch: scarecrow repairman & rocket surgeon / felix@crowfix.com
GPG = E987 4493 C860 246C 3B1E 6477 7838 76E9 182E 8151 ITAR license #4933
I've found a solution to Fermat's Last Theorem but I see I've run out of room o
 
Old 11-06-2009, 03:09 PM
Volker Armin Hemmann
 
Default How compatible are the various gcc -O flags?

On Freitag 06 November 2009, felix@crowfix.com wrote:
> How compatible are the various gcc optimization flags? Are they
> internal to a single program, do they affect library calls? Can some
> packages be made with one flag and still work with other packages made
> with other flags?
>
> Let me make up some completely fake examples. Suppose -Ox unrolls
> loops. I can't see how any other code could ever notice, so it would
> be perfectly fine to mix and match packages which have and don't have
> this optimization.
>
> Suppose -Oz changes the order of passing parameters on the stack
> because someone found a 0.3% speedup if the first parameter was first
> instead of last (or vice versa). Quite obviously this would be fatal
> for a -Oz package to call a non-Oz package. But suppose this
> optimization was only done inside static functions which were not
> visible to outside callers -- then it would be ok to mix.
>
> What brings this up is having changed CFLAGS to -O3 some time ago, I
> know not why. I found it by accident when a glib emerge made hald
> stop working which prevented X from running. Suppose I want to change
> this to -Os, or -O2, or -O1, or any of the other optimization flags,
> like -fomit-frame-pointer. What flags are incompatible with others?
>
> My gut feeling is that there aren't any such flags, otherwise how
> could you ever recompile anything except as cross platform? But then,
> maybe certain packages are set to filter certain flags, maybe gcc and
> the tool chain do this to isolate themselves from dangerous flags.
>

the O levels are compatible. Almost all flags are, except mrec-parm or what it
was called. man gcc can answer that for you.
 

Thread Tools




All times are GMT. The time now is 12:30 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org