All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scripts/faddr2line: s/vmlinux.o/vmlinux
@ 2022-05-02 20:07 Josh Poimboeuf
  0 siblings, 0 replies; only message in thread
From: Josh Poimboeuf @ 2022-05-02 20:07 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: linux-kernel

Fix Peter Zijlstra's use case of running faddr2line on vmlinux.o.  This
avoids (for now) the task of having to make this script a lot smarter.

Fixes the following issue:

  $ ./scripts/faddr2line vmlinux.o enter_from_user_mode+0x24
  bad symbol size: base: 0x0000000000005fe0 end: 0x0000000000005fe0

Reported-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
---
 scripts/faddr2line | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/scripts/faddr2line b/scripts/faddr2line
index 2a130134f1e6..564774803b9f 100755
--- a/scripts/faddr2line
+++ b/scripts/faddr2line
@@ -202,6 +202,19 @@ LIST=0
 [[ ! -f $objfile ]] && die "can't find objfile $objfile"
 shift
 
+# HACK: s/vmlinux.o/vmlinux
+#
+# peterz likes to run this script on vmlinux.o, which is more likely to run up
+# against the inherent limitations of this script being based on 'nm', which
+# lumps the symbol offsets of all text sections together.  If the offset is
+# valid for multiple text sections, faddr2line will get confused.
+#
+# This issue doesn't *only* affect vmlinux.o, but vmlinux.o is most likely to
+# see it compared to other .o files.  Someday, if necessary, we may need to
+# instead turn this script into a much smarter one which relies on a real tool
+# like readelf which can differentiate between text sections.
+objfile=${objfile/vmlinux.o/vmlinux}
+
 DIR_PREFIX=supercalifragilisticexpialidocious
 find_dir_prefix $objfile
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-05-02 20:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-02 20:07 [PATCH] scripts/faddr2line: s/vmlinux.o/vmlinux Josh Poimboeuf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.