diff mbox series

[v3] elfutils: Fix backtrace ptests on musl

Message ID 20261201165213.1801508-1-khem.raj@oss.qualcomm.com
State New
Headers show
Series [v3] elfutils: Fix backtrace ptests on musl | expand

Commit Message

Khem Raj Dec. 1, 2026, 4:52 p.m. UTC
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.

With musl-dbg installed, run-backtrace-data.sh and run-deleted.sh pass
on musl too, so drop them from the musl XFAIL list.

run-deleted.sh still fails on musl when the test library is linked with
lld. lld packs all segments of deleted-lib.so into the first file page,
so musl maps every segment at file offset 0, and once the file is
deleted elfutils cannot find the CFI of libfunc in the copy it reads
back from memory. Keep it as XFAIL for musl with ld-is-lld.
run-backtrace-data.sh is already XFAIL with ld-is-lld.

It also still fails on aarch64 musl, for a different reason: eu-stack
stops in libc while unwinding the sleeping process:

  #0  __syscall_cp_asm
  #1  __syscall_cp_c
  #2  0x0000ffff92090d28
  eu-stack: dwfl_thread_getframes ... in /usr/lib/libc.so: no matching address range

__syscall_cp_asm is assembly without CFI, so the first step is a
fallback guess, and on aarch64 it does not leave a usable state for the
next frame. Keep run-deleted.sh as XFAIL for musl on aarch64.

AI-Generated: Uses Claude Code
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
---
v3: also keep run-deleted.sh as XFAIL for musl on aarch64; it fails
    there while unwinding out of libc's __syscall_cp_asm (reported by
    the autobuilder on qemuarm64-musl-ptest). qemux86-64-musl-ptest
    passes it with v2.
v2: keep run-deleted.sh as XFAIL for musl with ld-is-lld

 meta/recipes-devtools/elfutils/elfutils_0.197.bb | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/meta/recipes-devtools/elfutils/elfutils_0.197.bb b/meta/recipes-devtools/elfutils/elfutils_0.197.bb
index 253e1a65f0..1aa49b4dbf 100644
--- a/meta/recipes-devtools/elfutils/elfutils_0.197.bb
+++ b/meta/recipes-devtools/elfutils/elfutils_0.197.bb
@@ -53,6 +53,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() {
@@ -64,7 +65,9 @@  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-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"
+PTEST_XFAILS:append:libc-musl = " run-large-elf-file.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-compress-test.sh"
+PTEST_XFAILS:append:libc-musl = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld', ' run-deleted.sh', '', d)}"
+PTEST_XFAILS:append:libc-musl:aarch64 = " run-deleted.sh"
 
 ELFUTILS_PTEST_SKIP ?= ""
 ELFUTILS_PTEST_SKIP:append:qemuall = " run-stackprof-system.sh"