Thread (4 messages) 4 messages, 2 authors, 26d ago

Re: [PATCH] Revert "scripts/faddr2line: Combine three readelf calls into one"

flat view

From: Josh Poimboeuf <jpoimboe@kernel.org>
Date: 2026-09-14 19:00:35
Also in: lkml
Subsystem: faddr2line, the rest · Maintainers: Josh Poimboeuf, Linus Torvalds

On Sat, Sep 05, 2026 at 06:54:49AM +0530, Srikar Dronamraju wrote:
This reverts commit b8d9d9496c1e ("scripts/faddr2line: Combine three
readelf calls into one")

scripts/faddr2line stopped working on PowerPc systems with this commit.

Output  of scripts/faddr2line on latest kernel sources
$ scripts/faddr2line ./vmlinux need_active_balance+0x1d4/0x21c
$
Output of scripts/faddr2line with revert
$ scripts/faddr2line ./vmlinux need_active_balance+0x1d4/0x21c
need_active_balance+0x1d4/0x21c:
imbalanced_active_balance at kernel/sched/fair.c:12047
(inlined by) need_active_balance at kernel/sched/fair.c:12061
$

readelf on Powerpc when passed with --file-header --section-headers
--symbol --wide option doesnt show the line
 "There are 62 section headers, starting at offset 0x16f1a850:"

Hence faddr2line parsing gets broken.

It could be a bug in Powerpc readelf that this line doesnt get printed.
However since its breaking with existing readelf, its better to be
reverted.

With the revert, we end up calling readelf three times but this should
still be fine since calling faddr2line is a debug tool.

Fixes: b8d9d9496c1e ("scripts/faddr2line: Combine three readelf calls into one")
Signed-off-by: Srikar Dronamraju <redacted>
Can you run

  bash -x scripts/faddr2line ./vmlinux need_active_balance+0x1d4/0x21c

to see what line it's failing at?

Any chance the below fixes it?
diff --git a/scripts/faddr2line b/scripts/faddr2line
index 622875396bcfc..550c0f9b9d473 100755
--- a/scripts/faddr2line
+++ b/scripts/faddr2line
@@ -78,7 +78,7 @@ GREP="grep"
 
 # Enforce ASCII-only output from tools like readelf
 # ensuring sed processes strings correctly.
-export LANG=C
+export LC_ALL=C
 
 command -v ${AWK} >/dev/null 2>&1 || die "${AWK} isn't installed"
 command -v ${READELF} >/dev/null 2>&1 || die "${READELF} isn't installed"
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help