public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
From: mark.yang@lge.com
To: openembedded-core@lists.openembedded.org
Cc: "mark.yang" <mark.yang@lge.com>
Subject: [PATCH] package.py: skip dwarfsrcfiles for Clang LTO static libraries
Date: Sun, 28 Dec 2025 12:19:53 +0900	[thread overview]
Message-ID: <20251228031953.4024552-1-mark.yang@lge.com> (raw)

From: "mark.yang" <mark.yang@lge.com>

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 <mark.yang@lge.com>
---
 meta/lib/oe/package.py | 8 ++++++++
 1 file changed, 8 insertions(+)

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)


             reply	other threads:[~2025-12-28  3:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-28  3:19 mark.yang [this message]
2025-12-29 11:13 ` [OE-core] [PATCH] package.py: skip dwarfsrcfiles for Clang LTO static libraries Alexander Kanavin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251228031953.4024552-1-mark.yang@lge.com \
    --to=mark.yang@lge.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox