Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 927157

Summary: cmake.eclass: pass -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=OFF
Product: Gentoo Linux Reporter: Sam James <sam>
Component: EclassesAssignee: Gentoo's Team for Core System packages <base-system>
Status: CONFIRMED ---    
Severity: normal CC: eschwartz93, kde
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://bugs.gentoo.org/show_bug.cgi?id=856778
https://bugs.gentoo.org/show_bug.cgi?id=927037
Whiteboard:
Package list:
Runtime testing required: ---

Description Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-03-17 06:13:38 UTC
This came up in bug 856778 where it appears that LTO is coming from pybind11 (!) which defaults to LTO per https://github.com/pybind/pybind11/blob/8b48ff878c168b51fe5ef7b8c728815b9e1a9857/docs/compiling.rst#pybind11_add_module.

We should set -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=OFF in the eclass. THe user can enable LTO if they want.

Alternatively, we could do the meson.eclass appraoch and check for tc-is-lto first...?
Comment 2 Eli Schwartz 2024-03-17 06:30:17 UTC
Note the meson.eclass approach is beneficial since there are meson projects that specifically set some targets known to not work with LTO to off.

e.g. scipy has some really old fortran code with no intention of fixing it, since they just want to migrate *away* from it. So they force LTO off, but other scipy extension modules are expected to work fine.

Similar logic may or may not apply to cmake / projects using cmake. (Or might not apply.)
Comment 3 Mike Gilbert gentoo-dev 2024-03-17 13:27:23 UTC
Note that cmake seems to add -flo=auto when this option is enabled. Not sure if there is any way to control the exact flags it adds.