This message outlines a plan for modifying the GCC driver to support
compilation in LTO mode.  The goal is that:

  gcc --lto foo.c bar.o

will generate LTO information for foo.c, while compiling it, then invoke
the LTO front end for foo.o and bar.o, and then invoke the linker.

However, as a first step, the LTO front end will be invoked separately
for foo.o and bar.o -- meaning that the LTO front end will not actually
do any link-time optimization.  The reason for this first step is that
it's easier, and that it will allow us to run through the GCC testsuite
in LTO mode, eliminating failures in single-file mode, before we move on
to multi-file mode.

The key idea is to leverage the existing collect2 functionality for
reinvoking the compiler.  That's presently used for static
constructor/destructor handling and for instantiating templates in
-frepo mode.

So, the work plan is as follows:

1. Add a --lto option to collect2.  When collect2 sees this option,
treat all .o files as if they were .rpo files and recompile them.  We
will do this after all C++ template instantiation has been done, since
we want to optimize the .o files after the program can actually link.

2. Modify the driver so that --lto passes -flto to the C front-end and
--lto to collect2.

Any objections to this plan?

-- 
Mark Mitchell
CodeSourcery
[EMAIL PROTECTED]
(650) 331-3385 x713

Reply via email to