From: Srikar Dronamraju <srikar@linux.ibm.com>
To: Josh Poimboeuf <jpoimboe@kernel.org>,
Brian Johannesmeyer <bjohannesmeyer@gmail.com>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>,
linuxppc-dev <linuxppc-dev@lists.ozlabs.org>,
Srikar Dronamraju <srikar@linux.ibm.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH] Revert "scripts/faddr2line: Combine three readelf calls into one"
Date: Sat, 5 Sep 2026 06:54:49 +0530 [thread overview]
Message-ID: <20260905012449.3872882-2-srikar@linux.ibm.com> (raw)
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 <srikar@linux.ibm.com>
---
scripts/faddr2line | 15 +++------------
1 file changed, 3 insertions(+), 12 deletions(-)
diff --git a/scripts/faddr2line b/scripts/faddr2line
index 622875396bcf..bf2098beefbe 100755
--- a/scripts/faddr2line
+++ b/scripts/faddr2line
@@ -111,19 +111,10 @@ find_dir_prefix() {
run_readelf() {
local objfile=$1
- local tmpfile
- tmpfile=$(mktemp)
- ${READELF} --file-header --section-headers --symbols --wide "$objfile" > "$tmpfile"
-
- # This assumes that readelf first prints the file header, then the section headers, then the symbols.
- # Note: It seems that GNU readelf does not prefix section headers with the "There are X section headers"
- # line when multiple options are given, so let's also match with the "Section Headers:" line.
- ELF_FILEHEADER=$(sed -n '/There are [0-9]* section headers, starting at offset\|Section Headers:/q;p' "$tmpfile")
- ELF_SECHEADERS=$(sed -n '/There are [0-9]* section headers, starting at offset\|Section Headers:/,$p' "$tmpfile" | sed -n '/Symbol table .* contains [0-9]* entries:/q;p')
- ELF_SYMS=$(sed -n '/Symbol table .* contains [0-9]* entries:/,$p' "$tmpfile")
-
- rm -f -- "$tmpfile"
+ ELF_FILEHEADER=$(${READELF} --file-header $objfile)
+ ELF_SECHEADERS=$(${READELF} --section-headers --wide $objfile)
+ ELF_SYMS=$(${READELF} --symbols --wide $objfile)
}
check_vmlinux() {
--
2.52.0
reply other threads:[~2026-09-05 1:27 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20260905012449.3872882-2-srikar@linux.ibm.com \
--to=srikar@linux.ibm.com \
--cc=bjohannesmeyer@gmail.com \
--cc=jpoimboe@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
/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
all inboxes | Powered by JetHome®