You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
FEATURE: Make the LLVM disassembler an optional runtime dependency #262
The LLVM library is only used to disassemble JIT-compiled (native) programs,
i.e. bpftool prog dump jited. Every other use case works
without LLVM. For scripting, automation, and CI, dragging in ~140 MB of LLVM
just to have a single optional command available is a heavy cost.
Proposal
Load the LLVM disassembler lazily at runtime via dlopen/dlsym instead of
linking against it at build time. When prog dump jited is invoked and the
library is unavailable, fall back gracefully (libbfd, or an informative message).
This would remove the automatic ELF dependency on libLLVM.so, allowing distributions to make
LLVM a weak/optional dependency (e.g. RPM Recommends) rather than a hard one.
Prior art
The perf tool is solving the exact same problem (libLLVM/libcapstone
bloating dependencies for users who never disassemble) by dlopen-ing these
libraries at runtime, so distributions can ship them as a separate, optional
package:
changed the title [-]FEATURE: Title: Make the LLVM disassembler an optional runtime dependency[/-][+]FEATURE: Make the LLVM disassembler an optional runtime dependency[/+]on May 30, 2026
Move the LLVM disassembler into a small separate .so (e.g. libbpftool-llvm.so)
that links libLLVM normally, and dlopen it only when prog dump jited needs it. The main binary then has no link-time dependency on libLLVM.
The split follows the existing interface in jit_disasm.c: disasm_init(), init_context(), disassemble_insn(), destroy_context() go into the .so; disasm_print_insn() stays in the binary and drives the loop/JSON formatting.
Thanks for the suggestion. I'm not opposed to it, although we probably want to keep the disassembler built-in when libbfd is used. Do you plan to work on this?
Activity
[-]FEATURE: Title: Make the LLVM disassembler an optional runtime dependency[/-][+]FEATURE: Make the LLVM disassembler an optional runtime dependency[/+]socketpair commentedon May 30, 2026
A concrete approach:
Move the LLVM disassembler into a small separate
.so(e.g.libbpftool-llvm.so)that links libLLVM normally, and
dlopenit only whenprog dump jitedneeds it. The main binary then has no link-time dependency on libLLVM.The split follows the existing interface in
jit_disasm.c:disasm_init(),init_context(),disassemble_insn(),destroy_context()go into the .so;disasm_print_insn()stays in the binary and drives the loop/JSON formatting.qmonnet commentedon Jun 1, 2026
Thanks for the suggestion. I'm not opposed to it, although we probably want to keep the disassembler built-in when libbfd is used. Do you plan to work on this?
bpftool: Move LLVM functionality into plugin (fixes libbpf#262)
socketpair commentedon Jun 1, 2026
@qmonnet Please review the PR
mirror: bpftool: Move LLVM functionality into plugin (fixes libbpf#262)
mirror: bpftool: Move LLVM functionality into plugin (fixes libbpf#262)
mirror: bpftool: Move LLVM functionality into plugin (fixes libbpf#262)
mirror: bpftool: Move LLVM functionality into plugin (fixes libbpf#262)
mirror: bpftool: Move LLVM functionality into plugin (fixes libbpf#262)
socketpair commentedon Jun 3, 2026
https://lore.kernel.org/bpf/20260603-bpftool-plugin-v1-1-68c0ac91f5a3@gmail.com/T/#u
bpftool: Make the LLVM disassembler an optional runtime dependency
bpftool: Make the LLVM disassembler an optional runtime dependency
bpftool: Make the LLVM disassembler an optional runtime dependency
7 remaining items
bpftool: Make the LLVM disassembler an optional runtime dependency
bpftool: Make the LLVM disassembler an optional runtime dependency
bpftool: Make the LLVM disassembler an optional runtime dependency
bpftool: Make the LLVM disassembler an optional runtime dependency
bpftool: Make the LLVM disassembler an optional runtime dependency
bpftool: Make the LLVM disassembler an optional runtime dependency
bpftool: Make the LLVM disassembler an optional runtime dependency
bpftool: Make the LLVM disassembler an optional runtime dependency
bpftool: Make the LLVM disassembler an optional runtime dependency
bpftool: Make the LLVM disassembler an optional runtime dependency
bpftool: Make the LLVM disassembler an optional runtime dependency
bpftool: Make the LLVM disassembler an optional runtime dependency
bpftool: Make the LLVM disassembler an optional runtime dependency
bpftool: Make the LLVM disassembler an optional runtime dependency
bpftool: Make the LLVM disassembler an optional runtime dependency