------- Comment #5 from rguenth at gcc dot gnu dot org 2010-07-20 09:00 ------- I was refering to a situation like
gcc -c -flto t1.c gcc -c t2.c gcc -o t.o -r -nostdlib t1.o t2.o [-flto] gcc -o t t.o -flto which would break with your solution (it's broken right now as well, of course). We could make it work by not emitting code but only LTO sections for t1.o. Then the partial link would cause us to have both LTO sections and regular sections, so at link-time we'd pick up the LTO parts for re-optimization and link the code parts without re-optimization. We'd still need a way to merge LTO sections (or mangle them like you do), of course. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44992