Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 941602 - app-containers/lxc does not respect CFLAGS="-flto=thin"
Summary: app-containers/lxc does not respect CFLAGS="-flto=thin"
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Joonas Niilola
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-10-16 05:44 UTC by Sandi (Sandy) Vujaković
Modified: 2024-10-16 08:06 UTC (History)
3 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 Sandi (Sandy) Vujaković 2024-10-16 05:44:18 UTC
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
```
Comment 1 Ionen Wolkens gentoo-dev 2024-10-16 06:05:52 UTC
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.
Comment 2 Sandi (Sandy) Vujaković 2024-10-16 06:48:42 UTC
> 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.
Comment 3 Joonas Niilola gentoo-dev 2024-10-16 08:06:49 UTC
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.