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 <[email protected]>
---
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