gcc -flto -fno-lto hello.c generates LTO objects. It should not.
In large makefiles it's often convenient to use -fno... to disable
something for only specific files.
Same bug seems to be in the code generating phase
gcc -O2 -flto -fno-lto object.o
does code generation even if object.o has fallback code
I suppose using the linker plugin shows similar effects at link stage? I think
this is a specs issue, the driver passes on -flto* if -fno-lto was on the
Date: Sun Dec 19 19:36:25 2010
New Revision: 168071
Fix -fno-lto (PR lto/46905)
2010-12-19 Andi Kleen <email@example.com>
* collect2.c (main): Handle -fno-lto.
* opts.c (common_handle_option): Handle -fno-lto.
Linker plugin has also problem of doing LTO even when not asked for. I will look into it once slib LTO bits are settled.
slim lto will take some time (next stage1)
i also plan to drop most of the code because with forced plugin
the elf code in collect2 should not be needed anymore.
And to add: if you have more fixes for -fno-lto please add them now,
> slim lto will take some time (next stage1)
I was chatting about this with Diego yesterday and he seems to be fine with the
basic slim LTO patch getting in. So it seems to me that we might get the slim
LTO patch for 4.6.0 and flip the default for 4.7.0
> i also plan to drop most of the code because with forced plugin
> the elf code in collect2 should not be needed anymore.
I don't know. Current collect2 code is utterly broken by using wrong symbol
table at first place. With GNU LD getting plugin support the situation got
better, but we still have darwin target where we have no linker support at all.
Apple linker has plugin, so probably one can write plugin glue, but until that
happens, we probably want to keep collect2 path somehow useable.
What I am aware of WRT plugin and LTO is that currently plugin force LTO by
gcc -flto t.c -c
will result in WHOPR while producing a.out
I ended up enabling plugin by defualt since that is a must for plugin, but plugin
should be extended to work out whether -flto was passed on the command line (or
be better told by the driver as we don't want to duplicate parsing everywhere)
and when lto is not passed do not claim objects that are not slim.
AFAIK this works now.