Hi,
this is my honest attempt to explain how command line options works with LTO
in current compiler and how to deal with these sanely.

It is bit of mess, but an improvement over past releases.  We finished the
transition to per-function attributes.  In GCC 6 I plan to add per-variable
counterpart.  I wonder if we want to have something in the texinfo too?

Honza

Index: changes.html
===================================================================
RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-5/changes.html,v
retrieving revision 1.90
diff -u -r1.90 changes.html
--- changes.html        23 Mar 2015 02:00:12 -0000      1.90
+++ changes.html        23 Mar 2015 02:22:51 -0000
@@ -78,6 +78,25 @@
          Streaming extra information needed to merge types adds about 2-6% of
          memory size and object size increase. This can be controlled by
          <code>-flto-odr-type-merging</code>.</li>
+      <li><p>Command line optimization and target options are now streamed on
+         per-function basis and honored by the link-time optimizer.
+         This change makes the link-time optimization more tranpsarent
+         replacement of the per-file optimization.
+         It is now possible to build projects that require different 
optimization
+         settings for different translation units (such as
+         <code>-ffast-math</code>, <code>-mavx</code>, or 
<code>-finline</code>).
+         Contrary to the earlier GCC releases, the optimization and target
+         options passed to the command line invoking linker are ignored.</p>
+         <p>Note that this apply only to those command
+         line options that can be passed to <code>optimize</code> and
+         <code>target</code> attributes.  Command line options affecting global
+         code generation (such as <code>-fpic</code>), warnings
+         (such as <code>-Wodr</code>), optimization affecting way static 
variables
+         are optimized (such as <code>-fcommon</code>), debug output (such as
+         <code>-g</code>) and <code>--param</code> parameters can be applied 
only
+         to the whole link-time optimization unit. 
+         It these cases it is recommended to consistently use the same setting
+         both at compile-time and link-time.</p>
       <li>GCC bootstrap now uses slim LTO object files.</li>
       <li>Memory usage and link times were improved.  Tree merging was sped up,
          memory usage of GIMPLE declarations and types was reduced, and,

Reply via email to