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 <[email protected]>
---
meta/classes/toolchain/gcc.bbclass | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/meta/classes/toolchain/gcc.bbclass
b/meta/classes/toolchain/gcc.bbclass
index 0ed49ba892..2df5281ee2 100644
--- a/meta/classes/toolchain/gcc.bbclass
+++ b/meta/classes/toolchain/gcc.bbclass
@@ -32,4 +32,9 @@
PREFERRED_PROVIDER_virtual/nativesdk-compilerlibs:class-cross-canadian = "native
DEBUG_PREFIX_MAP_EXTRA = "-fcanon-prefix-map"
+# GCC possibly injects build strings when using LTO unless DEBUG_PREFIX_MAP
+# flags are given:
+# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109805
+TARGET_LDFLAGS:append:class-target = " ${DEBUG_PREFIX_MAP}"
+
TCOVERRIDE = "toolchain-gcc"
--
2.52.0
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#233889):
https://lists.openembedded.org/g/openembedded-core/message/233889
Mute This Topic: https://lists.openembedded.org/mt/118499279/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-