While link-time optimizations “LTO” can deliver some nice performance benefits out of this compiler optimization technique, it can make debugging said binaries more challenging. Due to various bugs in Mesa being attributed to the use of compiler link-time optimizations when compiling Mesa, the builds are being blocked on using LTO.
A merge today to Mesa Git adjusts the Meson build system integration to error out if the compiler “-flto” flag is set:
“Building Mesa with LTO is not supported. Please disable LTO for building Mesa.”
Mesa is now explicitly rejecting LTO for building Mesa to avoid bugs. Though for those really serious about LTO’ing Mesa, they do add a “allow-broken-lto” option to Mesa to override this error and proceed with an LTO-optimized Mesa build.
The merge request noted:
“LTO is not supported with Mesa. It has caused random impossible-to-debug bugs for a long time, and LTO bug reports are generally considered a “WONTFIX please disable LTO instead”. Let’s make this clear to users and packagers so they don’t run into more weird issues that result in inactionable reports.”
Hopefully the compiler LTO support with GCC and to a lesser extent LLVM/Clang will be improved with time that these checks can be revised for those wanting to LTO their Mesa build in the name of greater performance.
