On Fri, Jul 12, 2013 at 09:49:28AM -0700, Thomas Schwinge wrote:
> Hi!
> 
> On Fri, 12 Jul 2013 16:54:21 +0200 (CEST), Marc Glisse <marc.gli...@inria.fr> 
> wrote:
> > this patch makes the driver pass -O2 to GNU ld if gcc was called with -O3 
> > (or more), -Ofast or -Os.
> 
> I wondered about this before: why are no -O flags are passed to the (GNU)
> linker.
> 
> What's the rationale for the mapping you propose of GCC and linker
> optimization flags?  Why not a one-to-one mapping?

Because there is no 1:1 mapping.  I bet ld doesn't grok -Os or -Ofast or
-Og, and what -O* does in the linker doesn't have direct correspondence to
what -O* does in the compiler.  Last time I've looked, -O* in the linker
just enabled some link time expensive computation of the hash table,
so enabling -O in the linker for -O1 in the compiler is definitely not a
good idea, similarly for -Og, those definitely want speed rather than better
hash table.

        Jakub

Reply via email to