According to this, as of GCC 5, object files compiled with LTO enabled do not necessarily need to have the same optimization flags during the linking phase. However, I could not find equivalent documentation about the behaviour in LLVM Clang. Can I really just append -flto
to the compiler variable of whatever build system (e.g. CXX
in GNU Make) like one [supposedly] can in GCC, without the need to give any redundant flags to the frontend during linking? What is Clang's behaviour when the optimization flags do not match?
I don't actually have any specific version of LLVM in mind, so assume something recent.