Help!

[gentoo-user] How compatible are the various gcc -O flags?

 
  

Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> User RSS
Next:  Accepted sugar-calculate-activity 30-5 (source al..  
Author Message
felix
External


Since: Feb 12, 2007
Posts: 6



PostPosted: Fri Nov 06, 2009 12:10 pm    Post subject: [gentoo-user] How compatible are the various gcc -O flags?
Archived from groups: linux>gentoo>user (more info?)

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.DeleteThis@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
Back to top
Volker Armin Hemmann
External


Since: Jun 27, 2009
Posts: 17



PostPosted: Fri Nov 06, 2009 12:10 pm    Post subject: Re: [gentoo-user] How compatible are the various gcc -O flags? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Freitag 06 November 2009, felix RemoveThis @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.
Back to top
Display posts from previous:   
Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> User All times are: Eastern Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum