On Wed, Mar 25, 2026 at 07:39:51AM -0400, Patrick Williams wrote: > When LTO is enabled, due to a gcc bug[1], the linker needs the same > flags in DEBUG_PREFIX_MAP as the compiler. Without this the buildpaths > QA failure can occur due to unstripped build directory strings in the > DWARF data. > > With GCC 15.2 this can be noticed by setting many meson-built packages, > such as systemd, with: > > EXTRA_OEMESON:append:class-target = " -Db_lto=true" > > Add the DEBUG_PREFIX_MAP to the TARGET_LDFLAGS for gcc. > > While the lto.inc enables LTO across the whole image, some packages > either manually enable LTO on their own or downstream recipe > maintainers have explicitly set LTO in specific packages, so it is not > sufficient to set this in lto.inc only. > > [1]: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109805 > > Signed-off-by: Patrick Williams > --- A few other mailing list threads also talk about this problem. One alternative is to re-add it to the TARGET_LDFLAGS in bitbake.conf by reverting 1797741aad02b8bf429fac4b81e30cdda64b5448 [1], but that seems to have problems for cgo applications which might be resolved by another patch[2]. Adding to lto.inc[3] isn't sufficient for the reasons I mentioned above. [1]: https://lore.kernel.org/openembedded-core/20260122194959.13457-2-rs@ti.com/#t [2]: https://lore.kernel.org/openembedded-core/20260127170344.2960247-2-rs@ti.com/ [3]: https://lore.kernel.org/openembedded-core/20260204052638.284617-1-changqing.li@windriver.com/ -- Patrick Williams