The LXC ebuilds override `b_lto` and `b_lto_mode` in `emesonargs`. The following (line 100 in 6.0.2) causes the ebuild to disable LTO unless the `lto` USE flag is set: ``` $(meson_use lto b_lto) ``` The following (lines 121-125 in 6.0.2) causes the LTO mode to always be set to `thin` for gold and LLD and to always be set to `default` otherwise: ``` if $(tc-ld-is-gold) || $(tc-ld-is-lld); then local emesonargs+=( -Db_lto_mode=thin ) else local emesonargs+=( -Db_lto_mode=default ) fi ```
If want lto you should normally be enabling USE=lto rather than expect it to be used when these flags are unset. But this logic likely predate what meson.eclass (newly) does, aka it handles auto-detecting lto from *FLAGS + passing meson flags, but then the ebuild is duplicating the logic and having a USE for nothing. So think this can all be dropped.
> If want lto you should normally be enabling USE=lto rather than expect it to be used when these flags are unset. Isn't `lto` being phased out in favour of `-flto*` in `*FLAGS`, hence the new Meson eclass logic? That's the impression I'm under at least.
I wasn't aware meson.eclass does this. Yeah, the ebuild has had it before it was added to meson.eclass. Something to update on next version bump for sure.