Hi, Consider some project, consisting of files: a.c, b.c, d.c and e.c
Compiler is gcc 4.6.2 Files a.c and b.c are performance bottlenecks and requires heavy cross-module inline, so must be compiled with -flto option Files d.c and e.c is preffered to be compiled with lto option too, but they are of special usage, and requires some registers (say r9 and r10) to be fixed (with -ffixed-<reg> option) during compilation. All these files forms single binary. Now the problem is: if I compiling gcc $OPTIONS -flto a.c -o a.o gcc $OPTIONS -flto b.c -o b.o gcc $OPTIONS -ffixed-r9 -ffixed-r10 -flto d.c -o d.o gcc $OPTIONS -ffixed-r9 -ffixed-r10 -flto e.c -o d.o and then gcc $OPTIONS -flto a.o b.o d.o e.o -o a.out Then registers inside d.o and e.o are being reallocated at link time, and r9, r10 are used in the d.o and e.o parts in the resulted binary. Also I can not specify fixed regs to final link, because this will fix registers in a.o and b.o parts, that will affect performance. The best way for me seems to somehow separately link pseudo-object files a.o and b.o with -flto to simple object (say x.o), and then link e.o and d.o to single, say, y.o, and then call linker to finally link binary without cross-module optimizations. But I can not find possibility to do it, and I doubt if this at all conforms with lto ideology. So, I want to perform link-time optimizations between a.o and b.o, and don't want them between (a.o or b.o) and (d.o or e.o) How can I approach this? Thanks in advance for everyone, who will help. --- With best regards, Konstantin