From: mark.yang Date: Sun, 28 Dec 2025 03:19:53 +0000 (+0900) Subject: package.py: skip dwarfsrcfiles for Clang LTO static libraries X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c66f4a148086b5d25b11f95e7d84d9baf3530b5f;p=thirdparty%2Fopenembedded%2Fopenembedded-core.git package.py: skip dwarfsrcfiles for Clang LTO static libraries When using Clang toolchain with LTO enabled, static libraries (.a) contain LLVM bitcode objects instead of ELF objects. dwarfsrcfiles cannot process these files and fails with "not a valid ELF file" error. Rather than catching the error message, guard the dwarfsrcfiles call by checking for the specific conditions: static library (using is_static_lib() magic check) + clang toolchain + lto in DISTRO_FEATURES. When all conditions are met, skip the call silently. Signed-off-by: mark.yang Signed-off-by: Mathieu Dubois-Briand Signed-off-by: Richard Purdie --- diff --git a/meta/lib/oe/package.py b/meta/lib/oe/package.py index baaa0cba02..279cd567b3 100644 --- a/meta/lib/oe/package.py +++ b/meta/lib/oe/package.py @@ -770,6 +770,14 @@ def parse_debugsources_from_dwarfsrcfiles_output(dwarfsrcfiles_output): return debugfiles.keys() def source_info(file, d, fatal=True): + # Skip static libraries when using Clang toolchain with LTO enabled. + # In this case, .a files contain LLVM bitcode instead of ELF objects, + # and dwarfsrcfiles cannot process them. + if is_static_lib(file): + if d.getVar('TOOLCHAIN') == "clang" and bb.utils.contains('DISTRO_FEATURES', 'lto', True, False, d): + bb.debug(1, "Skipping dwarfsrcfiles for Clang LTO archive: %s" % file) + return [] + cmd = ["dwarfsrcfiles", file] try: output = subprocess.check_output(cmd, universal_newlines=True, stderr=subprocess.STDOUT)