public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf-next 0/7] bpftool: Add LLVM as default library for disassembling JIT-ed programs
@ 2022-09-06 13:36 Quentin Monnet
  2022-09-06 13:36 ` [PATCH bpf-next 1/7] bpftool: Define _GNU_SOURCE only once Quentin Monnet
                   ` (7 more replies)
  0 siblings, 8 replies; 24+ messages in thread
From: Quentin Monnet @ 2022-09-06 13:36 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko
  Cc: Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
	KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa, bpf,
	Niklas Söderlund, Simon Horman, Quentin Monnet

To disassemble instructions for JIT-ed programs, bpftool has relied on the
libbfd library. This has been problematic in the past: libbfd's interface
is not meant to be stable and has changed several times, hence the
detection of the two related features from the Makefile
(disassembler-four-args and disassembler-init-styled). When it comes to
shipping bpftool, this has also caused issues with several distribution
maintainers unwilling to support the feature (for example, Debian's page
for binutils-dev, libbfd's package, says: "Note that building Debian
packages which depend on the shared libbfd is Not Allowed.").

This patchset adds support for LLVM as the primary library for
disassembling instructions for JIT-ed programs.

We keep libbfd as a fallback. One reason for this is that currently it
works well, we have all we need in terms of features detection in the
Makefile, so it provides a fallback for disassembling JIT-ed programs if
libbfd is installed but LLVM is not. The other reason is that libbfd
supports nfp instruction for Netronome's SmartNICs and can be used to
disassemble offloaded programs, something that LLVM cannot do (Niklas
confirmed that the feature is still in use). However, if libbfd's interface
breaks again in the future, we might reconsider keeping support for it.

Quentin Monnet (7):
  bpftool: Define _GNU_SOURCE only once
  bpftool: Remove asserts from JIT disassembler
  bpftool: Split FEATURE_TESTS/FEATURE_DISPLAY definitions in Makefile
  bpftool: Group libbfd defs in Makefile, only pass them if we use
    libbfd
  bpftool: Refactor disassembler for JIT-ed programs
  bpftool: Add LLVM as default library for disassembling JIT-ed programs
  bpftool: Add llvm feature to "bpftool version"

 .../bpftool/Documentation/common_options.rst  |   8 +-
 tools/bpf/bpftool/Makefile                    |  65 +++--
 tools/bpf/bpftool/common.c                    |   2 +
 tools/bpf/bpftool/iter.c                      |   2 +
 tools/bpf/bpftool/jit_disasm.c                | 244 ++++++++++++++----
 tools/bpf/bpftool/main.c                      |  10 +
 tools/bpf/bpftool/main.h                      |  29 ++-
 tools/bpf/bpftool/map.c                       |   1 -
 tools/bpf/bpftool/net.c                       |   2 +
 tools/bpf/bpftool/perf.c                      |   2 +
 tools/bpf/bpftool/prog.c                      |  17 +-
 tools/bpf/bpftool/xlated_dumper.c             |   2 +
 12 files changed, 291 insertions(+), 93 deletions(-)

-- 
2.34.1


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

end of thread, other threads:[~2022-09-11 20:13 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-06 13:36 [PATCH bpf-next 0/7] bpftool: Add LLVM as default library for disassembling JIT-ed programs Quentin Monnet
2022-09-06 13:36 ` [PATCH bpf-next 1/7] bpftool: Define _GNU_SOURCE only once Quentin Monnet
2022-09-06 23:14   ` Song Liu
2022-09-06 13:36 ` [PATCH bpf-next 2/7] bpftool: Remove asserts from JIT disassembler Quentin Monnet
2022-09-06 23:16   ` Song Liu
2022-09-06 13:36 ` [PATCH bpf-next 3/7] bpftool: Split FEATURE_TESTS/FEATURE_DISPLAY definitions in Makefile Quentin Monnet
2022-09-06 23:18   ` Song Liu
2022-09-06 13:36 ` [PATCH bpf-next 4/7] bpftool: Group libbfd defs in Makefile, only pass them if we use libbfd Quentin Monnet
2022-09-06 23:31   ` Song Liu
2022-09-07 14:19     ` Quentin Monnet
2022-09-06 13:36 ` [PATCH bpf-next 5/7] bpftool: Refactor disassembler for JIT-ed programs Quentin Monnet
2022-09-06 23:55   ` Song Liu
2022-09-06 13:36 ` [PATCH bpf-next 6/7] bpftool: Add LLVM as default library for disassembling " Quentin Monnet
2022-09-06 23:46   ` Alexei Starovoitov
2022-09-07 14:20     ` Quentin Monnet
2022-09-07 16:10       ` Alexei Starovoitov
2022-09-07 16:33         ` Quentin Monnet
2022-09-07 18:02           ` Yonghong Song
2022-09-11 20:13             ` Quentin Monnet
2022-09-07  0:06   ` Song Liu
2022-09-07 14:20     ` Quentin Monnet
2022-09-07 16:37       ` Song Liu
2022-09-06 13:36 ` [PATCH bpf-next 7/7] bpftool: Add llvm feature to "bpftool version" Quentin Monnet
2022-09-10 19:41 ` [PATCH bpf-next 0/7] bpftool: Add LLVM as default library for disassembling JIT-ed programs Niklas Söderlund

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