From aa04707f507e0f8161d1d8a4cef748a3d66b189a Mon Sep 17 00:00:00 2001 From: Ian Rogers Date: Sun, 5 Oct 2025 14:22:05 -0700 Subject: perf dso: Support BPF programs in dso__read_symbol() Set the buffer to the code in the BPF linear info. This enables BPF JIT code disassembly by LLVM and capstone. Move the common but minimal disassmble_bpf_image call to disassemble_objdump so that it is only called after falling back to the objdump option. Similarly move the disassmble_bpf function to disassemble_objdump and rename to disassmble_bpf_libbfd to make it clearer that this support relies on libbfd. Signed-off-by: Ian Rogers Cc: Adrian Hunter Cc: Alexander Shishkin Cc: Alexandre Ghiti Cc: Andi Kleen Cc: Athira Rajeev Cc: Bill Wendling Cc: Charlie Jenkins Cc: Collin Funk Cc: Dmitriy Vyukov Cc: Dr. David Alan Gilbert Cc: Eric Biggers Cc: Haibo Xu Cc: Ingo Molnar Cc: James Clark Cc: Jiri Olsa Cc: Justin Stitt Cc: Li Huafei Cc: Masami Hiramatsu Cc: Namhyung Kim Cc: Nathan Chancellor Cc: Nick Desaulniers Cc: Peter Zijlstra Cc: Song Liu Cc: Stephen Brennan Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/libbfd.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tools/perf/util/libbfd.h') diff --git a/tools/perf/util/libbfd.h b/tools/perf/util/libbfd.h index 7441e95f8ec0..e300f171d1bd 100644 --- a/tools/perf/util/libbfd.h +++ b/tools/perf/util/libbfd.h @@ -29,7 +29,7 @@ int libbfd__read_build_id(const char *filename, struct build_id *bid, bool block int libbfd_filename__read_debuglink(const char *filename, char *debuglink, size_t size); -int symbol__disassemble_bpf(struct symbol *sym, struct annotate_args *args); +int symbol__disassemble_bpf_libbfd(struct symbol *sym, struct annotate_args *args); #else // !defined(HAVE_LIBBFD_SUPPORT) #include "annotate.h" @@ -72,8 +72,8 @@ static inline int libbfd_filename__read_debuglink(const char *filename __always_ return -1; } -static inline int symbol__disassemble_bpf(struct symbol *sym __always_unused, - struct annotate_args *args __always_unused) +static inline int symbol__disassemble_bpf_libbfd(struct symbol *sym __always_unused, + struct annotate_args *args __always_unused) { return SYMBOL_ANNOTATE_ERRNO__NO_LIBOPCODES_FOR_BPF; } -- cgit v1.2.3