LTO on Windows now working

Luboš Luňák l.lunak at collabora.com
Fri Sep 25 09:12:38 UTC 2020


On Friday 25 of September 2020, Tor Lillqvist wrote:
> Would it be simpler if we didn't have a separate gb_LTOFLAGS but simply
> added the LTO flags into $CC and $CXX (or $CFLAGS)?
>
> I think that at least with Apple's linker, using "Thin" LTO (
> https://blog.llvm.org/posts/2016-06-21-thinlto-scalable-and-incremental-lto
>/ ) is supposed to be quite transparent. You just compile all (or even just
> a subset) of your source code with -flto=thin, and the linker will notice
> and apply LTO to those objects. You will just notice the increased link
> time, (Probably offset by somewhat decreased compile time, though.)


 The link time vastly increases compared to compile time savings. Adding LTO 
flags directly to CFLAGS/CXXFLAGS would apply LTO to everything, which 
possibly wouldn't really be worth it.

> The -flto=thin mode is available also in Clang on LInux, but, as you say,
> then you need to know that the linker that gets used also supports it.

 Not just the linker. As soon as static libraries are involved, ar and ranlib 
need to be LTO-capable as well.

 This all shouldn't be that difficult to check in configure though.

-- 
 Luboš Luňák
 l.lunak at collabora.com


More information about the LibreOffice mailing list