From: "mark.yang" <[email protected]>

When using the Clang toolchain with LTO, intermediate .o files are generated as
LLVM bitcode files instead of ELF files. While .so libraries are ultimately
ELF, .a files are not. In this case, dwarfsrcfiles always fails.

Adding the -ffat-lto-objects option allows the Clang toolchain to produce .o
files that are recognized as ELF, but this is not always a suitable solution
as it causes issues when used in conjunction with -fsanitize=cfi.

Therefore, we need to handle cases where dwarfsrcfiles encounters a file that
is not a valid ELF. Change the behavior from a fatal error to a warning to
notify the user.

Signed-off-by: mark.yang <[email protected]>
---
 meta/lib/oe/package.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/meta/lib/oe/package.py b/meta/lib/oe/package.py
index baaa0cba02..56b9bcd546 100644
--- a/meta/lib/oe/package.py
+++ b/meta/lib/oe/package.py
@@ -782,8 +782,12 @@ def source_info(file, d, fatal=True):
     if retval != 0 and retval != 255:
         msg = "dwarfsrcfiles failed with exit code %s (cmd was %s)%s" % 
(retval, cmd, ":\n%s" % output if output else "")
         if fatal:
-            bb.fatal(msg)
-        bb.note(msg)
+            if "not a valid ELF file" in output:
+                bb.warn(msg)
+            else:
+                bb.fatal(msg)
+        else:
+            bb.note(msg)
 
     debugsources = parse_debugsources_from_dwarfsrcfiles_output(output)
 
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#228547): 
https://lists.openembedded.org/g/openembedded-core/message/228547
Mute This Topic: https://lists.openembedded.org/mt/116947501/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to