David Brown<david.brown@hesbynett.no> writes:
After doing a bit more reading and thinking, it seems to me that
-fwhole-program will be used in most cases where LTO is used. You use
-flto when compiling each source file, then link them with gcc with
-flto and -fwhole-program. Except in the case of libraries or other
files which need external symbols, you will want that combination to
generate optimal code. So if this combination alone, without common
symbols, is going to cause problems, then this would be a much bigger
issue than if it is only triggered by common symbols.
That scenario is fine.
You can look back to see the problematic case posted earlier. It was
a case where one file was compiled with -flto, one file was compiled
without -flto, both files defined a common symbol with the same name,
the object files were linked together using -flto -fwhole-program, and
the gold plugin was not used. All elements are essential to recreate
the problem.