Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 927157 - cmake.eclass: pass -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=OFF
Summary: cmake.eclass: pass -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=OFF
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-03-17 06:13 UTC by Sam James
Modified: 2024-03-17 13:27 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.