Issue with LTO/-fwhole-program
Ian Lance Taylor
iant@google.com
Fri Jun 11 23:28:00 GMT 2010
Manuel López-Ibáñez <lopezibanez@gmail.com> writes:
> This also means that linking your program with non-LTO+whole-program
> code may lead to miscompilations without any warning, which is really
> bad. I don't think it is a reasonable limitation and we will get bad
> press when programs start breaking for users. They won't care (and
> they won't even listen) about the reasons. The conclusion will be: LTO
> is broken in GCC, and just use another compiler.
The limitation isn't all that bad. If you want to use
-fwhole-program, I think the basic rule is this: compile all your code
with -flto, and don't define variables or functions which are
referenced by any code which is not yours.
I think adding a warning for this case would be great, if we can
figure out how to do it. But I also think that a clear statement in
the documentation will avoid most user problems.
Ian
More information about the Gcc
mailing list