Linux Perf Users
 help / color / mirror / Atom feed
* [PATCH v1 0/7] perf annotate: Add elfutils libasm disassembler backend
@ 2026-06-09  5:17 Ian Rogers
  2026-06-09  5:17 ` [PATCH v1 1/7] tools build: Add feature check for elfutils libasm Ian Rogers
                   ` (6 more replies)
  0 siblings, 7 replies; 14+ messages in thread
From: Ian Rogers @ 2026-06-09  5:17 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Namhyung Kim, Jiri Olsa, Ian Rogers, Adrian Hunter, James Clark,
	Nick Terrell, David Sterba, Nathan Chancellor, Tomas Glozar,
	Blake Jones, Dmitrii Dolgov, Alexandre Chartre, Costa Shulyupin,
	Yuzhuo Jing, Michael Jeanson, Leo Yan, Tianyou Li, Zecheng Li,
	Rong Bao, linux-kernel, linux-perf-users, bpf

This series implements a new native disassembler backend for `perf annotate`
using elfutils' libasm.

Currently, `perf annotate` defaults to invoking an external `objdump`
process when native disassemblers like Capstone or LLVM are either
not compiled in or unable to handle the target binary. This fallback
incurs significant overhead due to process forking, output parsing,
and external process management. It is also inherently fragile and
complicates environments where `objdump` might not be readily available.

This series integrates `libasm` directly into the perf tools to parse
instructions natively without any external process dependencies,
providing a robust native alternative to `objdump` using elfutils.
It adds:
  - Build checks and detection for the `libasm` elfutils library.
  - A comprehensive `symbol__disassemble_libasm` implementation.
  - A `--disassembler=<name>` flag to explicitly choose between backends
    (e.g., `libasm`, `objdump`, `capstone`, `llvm`).
  - Temporary ELF file generation for JITted BPF programs to allow
    `objdump` and `libasm` to decode them gracefully.
  - Full system-wide test coverage in `perf test` that validates normal
    ELF execution and BPF JIT output across all supported backends.

`perf annotate` will continue to seamlessly prioritize the available
disassembler backends, but `libasm` now provides a robust, native fallback
for standard environments using elfutils.

Ian Rogers (7):
  tools build: Add feature check for elfutils libasm
  perf build: Add build support and capability for elfutils libasm
  perf annotate: Implement elfutils libasm disassembler backend
  perf annotate: Add --disassembler command-line option
  perf test: Enhance annotate test coverage and isolate config
  perf annotate: Support BPF JIT disassembly via genelf
  perf test: Add BPF JIT annotation test coverage for all disassemblers

 tools/build/Makefile.feature       |   2 +
 tools/build/feature/Makefile       |   9 ++
 tools/build/feature/test-libasm.c  |  19 +++
 tools/perf/Makefile.config         |  23 ++++
 tools/perf/builtin-annotate.c      |  10 ++
 tools/perf/builtin-check.c         |   1 +
 tools/perf/tests/shell/annotate.sh | 125 ++++++++++++++++++++
 tools/perf/util/Build              |   1 +
 tools/perf/util/annotate.c         |   8 +-
 tools/perf/util/annotate.h         |   3 +
 tools/perf/util/disasm.c           | 110 ++++++++++++++++-
 tools/perf/util/disasm.h           |   1 +
 tools/perf/util/libasm.c           | 182 +++++++++++++++++++++++++++++
 tools/perf/util/libasm.h           |  27 +++++
 14 files changed, 513 insertions(+), 8 deletions(-)
 create mode 100644 tools/build/feature/test-libasm.c
 create mode 100644 tools/perf/util/libasm.c
 create mode 100644 tools/perf/util/libasm.h

-- 
2.54.0.1064.gd145956f57-goog


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2026-06-09  5:36 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-09  5:17 [PATCH v1 0/7] perf annotate: Add elfutils libasm disassembler backend Ian Rogers
2026-06-09  5:17 ` [PATCH v1 1/7] tools build: Add feature check for elfutils libasm Ian Rogers
2026-06-09  5:28   ` sashiko-bot
2026-06-09  5:17 ` [PATCH v1 2/7] perf build: Add build support and capability " Ian Rogers
2026-06-09  5:28   ` sashiko-bot
2026-06-09  5:17 ` [PATCH v1 3/7] perf annotate: Implement elfutils libasm disassembler backend Ian Rogers
2026-06-09  5:30   ` sashiko-bot
2026-06-09  5:17 ` [PATCH v1 4/7] perf annotate: Add --disassembler command-line option Ian Rogers
2026-06-09  5:17 ` [PATCH v1 5/7] perf test: Enhance annotate test coverage and isolate config Ian Rogers
2026-06-09  5:28   ` sashiko-bot
2026-06-09  5:17 ` [PATCH v1 6/7] perf annotate: Support BPF JIT disassembly via genelf Ian Rogers
2026-06-09  5:33   ` sashiko-bot
2026-06-09  5:17 ` [PATCH v1 7/7] perf test: Add BPF JIT annotation test coverage for all disassemblers Ian Rogers
2026-06-09  5:36   ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox