Issue with LTO/-fwhole-program

David Brown david.brown@hesbynett.no
Mon Jun 14 04:43:00 GMT 2010


Dave Korn wrote:
> On 13/06/2010 23:22, David Brown wrote:
> 
>> I agree that banning common symbols is not a complete solution.  But
>> perhaps it may be a partial solution until some more complete solution
>> is found and implemented?
>>
>> How about having a warning flag -Wcommon-lto 
> 
>> Incidentally, the original poster used -fwhole-program.  Is this
>> conflict only an issue when the -fwhole-program flag is used?  If that's
>> the case, then the warning could be conditional on that flag too,
>> meaning even rarer circumstances when false positives would be issued.
> 
>   Yes; it's not really a problem that is related to common symbols at all,
> it's basically to do with mixing LTO and non-LTO objects when -fwhole-program,
> if I understand right.
> 

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.

David





More information about the Gcc mailing list