Skip to content

Commit 08b8191

Browse files
qmonnetAlexei Starovoitov
authored andcommitted
bpftool: Add llvm feature to "bpftool version"
Similarly to "libbfd", add a "llvm" feature to the output of command "bpftool version" to indicate that LLVM is used for disassembling JIT-ed programs. This feature is mutually exclusive (from Makefile definitions) with "libbfd". Signed-off-by: Quentin Monnet <quentin@isovalent.com> Tested-by: Niklas Söderlund <niklas.soderlund@corigine.com> Acked-by: Yonghong Song <yhs@fb.com> Link: https://lore.kernel.org/r/20221025150329.97371-9-quentin@isovalent.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
1 parent ce4f660 commit 08b8191

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

tools/bpf/bpftool/Documentation/common_options.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
Print bpftool's version number (similar to **bpftool version**), the
88
number of the libbpf version in use, and optional features that were
99
included when bpftool was compiled. Optional features include linking
10-
against libbfd to provide the disassembler for JIT-ted programs
11-
(**bpftool prog dump jited**) and usage of BPF skeletons (some
12-
features like **bpftool prog profile** or showing pids associated to
13-
BPF objects may rely on it).
10+
against LLVM or libbfd to provide the disassembler for JIT-ted
11+
programs (**bpftool prog dump jited**) and usage of BPF skeletons
12+
(some features like **bpftool prog profile** or showing pids
13+
associated to BPF objects may rely on it).
1414

1515
-j, --json
1616
Generate JSON output. For commands that cannot produce JSON, this

tools/bpf/bpftool/main.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,11 @@ static int do_version(int argc, char **argv)
119119
#else
120120
const bool has_libbfd = false;
121121
#endif
122+
#ifdef HAVE_LLVM_SUPPORT
123+
const bool has_llvm = true;
124+
#else
125+
const bool has_llvm = false;
126+
#endif
122127
#ifdef BPFTOOL_WITHOUT_SKELETONS
123128
const bool has_skeletons = false;
124129
#else
@@ -154,6 +159,7 @@ static int do_version(int argc, char **argv)
154159
jsonw_name(json_wtr, "features");
155160
jsonw_start_object(json_wtr); /* features */
156161
jsonw_bool_field(json_wtr, "libbfd", has_libbfd);
162+
jsonw_bool_field(json_wtr, "llvm", has_llvm);
157163
jsonw_bool_field(json_wtr, "libbpf_strict", !legacy_libbpf);
158164
jsonw_bool_field(json_wtr, "skeletons", has_skeletons);
159165
jsonw_bool_field(json_wtr, "bootstrap", bootstrap);
@@ -172,6 +178,7 @@ static int do_version(int argc, char **argv)
172178
printf("using libbpf %s\n", libbpf_version_string());
173179
printf("features:");
174180
print_feature("libbfd", has_libbfd, &nb_features);
181+
print_feature("llvm", has_llvm, &nb_features);
175182
print_feature("libbpf_strict", !legacy_libbpf, &nb_features);
176183
print_feature("skeletons", has_skeletons, &nb_features);
177184
print_feature("bootstrap", bootstrap, &nb_features);

0 commit comments

Comments
 (0)