I have a project where I use -flto=thin
for my main targets, but I don't want to apply LTO to my tests since it slows compilation down (full context: lld runs LTO even if -fno-lto is passed).
As it is suggested here, it is likely that if you compile with lto
the object files will only contain the intermediate language and no binary code. Therefore the tests will always be linked with LTO
GCC has the fat-lto-objects
option: "Fat LTO objects are object files that contain both the intermediate language and the object code. This makes them usable for both LTO linking and normal linking."
- Does clang have anything like that? It looks like that as for
clang++13
thefat-lto-objects
option is just ignored.