Skip to contentSkip to conversation

elfutils: Fix backtrace ptests on musl

PATCH In review Khem Raj 2 participants 3 messages Sep 28

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/2 elfutils: Fix backtrace ptests on musl

musl is built with -fno-asynchronous-unwind-tables, so libc.so carries almost no .eh_frame and its CFI only lives in .debug_frame. Without it the unwinder cannot get out of abort () and run-backtrace-dwarf.sh fails with "No DWARF information found". Add musl-dbg to the ptest dependencies, like glibc-dbg for glibc.

run-backtrace-native-core.sh then unwinds the thread correctly but loops on musl's __clone, which has no end-of-stack CFI. That is the same reason run-backtrace-native.sh is already an expected failure on musl, so mark the core variant as one too.

---
 meta/recipes-devtools/elfutils/elfutils_0.196.bb | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
meta/recipes-devtools/elfutils/elfutils_0.196.bb +2 -1
index 4541000840..167fe44d87 100644
@@ -54,6 +54,7 @@ EXTRA_OECONF:append:class-target = " --disable-tests-rpath"
 EXTRA_OECONF:append:class-target:microblaze = " --disable-symbol-versioning"
 
 RDEPENDS:${PN}-ptest:append:libc-glibc = " glibc-utils glibc-dbg glibc-dev"
+RDEPENDS:${PN}-ptest:append:libc-musl = " musl-dbg"
 INSANE_SKIP:${PN}-ptest = "debug-deps dev-deps"
 
 do_compile_ptest() {
@@ -65,7 +66,7 @@ PTEST_PARALLEL_MAKE = ""
 PTEST_XFAILS ?= ""
 # See - https://sourceware.org/bugzilla/show_bug.cgi?id=32232
 PTEST_XFAILS:append = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld', ' run-strip-strmerge.sh run-elflint-self.sh run-backtrace-data.sh run-reverse-sections-self.sh', '', d)}"
-PTEST_XFAILS:append:libc-musl = " run-large-elf-file.sh run-backtrace-data.sh run-backtrace-native.sh run-stack-d-test.sh run-stack-i-test.sh run-stack-demangled-test.sh run-deleted.sh run-compress-test.sh"
+PTEST_XFAILS:append:libc-musl = " run-large-elf-file.sh run-backtrace-data.sh run-backtrace-native.sh run-backtrace-native-core.sh run-stack-d-test.sh run-stack-i-test.sh run-stack-demangled-test.sh run-deleted.sh run-compress-test.sh"
 # systemwide stackprof tests need userspace CPU activity, which minimal qemu images lack
 PTEST_XFAILS:append:qemuall = " run-stackprof-system.sh run-stackprof-system-gprof.sh"
 
author
#1 lore raw

PATCH 2/2 libc-test: Always add libatomic-staticdev to ptest RDEPENDS

libc-test builds its tests on the target with the compiler from packagegroup-core-buildessential, which is always gcc. The toolchain used to build the recipe itself does not matter, since do_compile does nothing.

GCC 16 links -latomic_asneeded by default, so with the dependency limited to the gcc toolchain every static test fails to link when the distro builds with clang:

ld: cannot find -latomic_asneeded: Invalid argument
ld: have you installed the static version of the atomic_asneeded library ?

Add libatomic-staticdev unconditionally again.

---
 meta/recipes-core/musl/libc-test_git.bb | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
meta/recipes-core/musl/libc-test_git.bb +1 -2
index 15a2ce42f7..d9999ec377 100644
@@ -36,14 +36,13 @@ RDEPENDS:${PN} = " \
 
 RDEPENDS:${PN}-ptest = " \
      ${PN} \
+     libatomic-staticdev \
      locale-base-en-us \
      musl-staticdev \
      sed \
      tzdata \
 "
 
-RDEPENDS:${PN}-ptest:append:toolchain-gcc = " libatomic-staticdev"
-
 install_path = "/opt/${PN}"
 FILES:${PN} += "${install_path}/*"
 
#2 lore raw
In reply to Khem Raj
Quoted 6 lines · Khem Raj via lists.openembedded.org

musl is built with -fno-asynchronous-unwind-tables, so libc.so carries almost no .eh_frame and its CFI only lives in .debug_frame. Without it the unwinder cannot get out of abort () and run-backtrace-dwarf.sh fails with "No DWARF information found". Add musl-dbg to the ptest dependencies, like glibc-dbg for glibc.

Quoted 7 lines

run-backtrace-native-core.sh then unwinds the thread correctly but loops on musl's __clone, which has no end-of-stack CFI. That is the same reason run-backtrace-native.sh is already an expected failure on musl, so mark the core variant as one too.

---

Hi Khem,

I suspect this is breaking elfutils ptest on qemux86-64:

AssertionError:
Failed ptests:
{'elfutils': 'START: ptest-runner\n'

             '2026-09-28T06:47\n'
             'make  \\\n'
	     ...
	  '===============================================================\n'
             '2 of 258 tests did not behave as expected (2 unexpected passes)\n'
             '(44 tests were not run)\n'

https://autobuilder.yoctoproject.org/valkyrie/#/builders/110/builds/1263

Ptest logs can be found here:
https://valkyrie.yocto.io/pub/non-release/20260928-40/testresults/qemux86-64-musl-ptest/core-image-ptest-elfutils/

It does look like it reproduces on every builds, but does not affect other platforms.

Can you have a look at the issue?

Thanks,
Mathieu

Signature · 3 lines
Mathieu Dubois-Briand, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com