提交 08b8191b 编写于 作者: Q Quentin Monnet 提交者: Alexei Starovoitov

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: NQuentin Monnet <quentin@isovalent.com>
Tested-by: NNiklas Söderlund <niklas.soderlund@corigine.com>
Acked-by: NYonghong Song <yhs@fb.com>
Link: https://lore.kernel.org/r/20221025150329.97371-9-quentin@isovalent.comSigned-off-by: NAlexei Starovoitov <ast@kernel.org>
上级 ce4f6608
...@@ -7,10 +7,10 @@ ...@@ -7,10 +7,10 @@
Print bpftool's version number (similar to **bpftool version**), the Print bpftool's version number (similar to **bpftool version**), the
number of the libbpf version in use, and optional features that were number of the libbpf version in use, and optional features that were
included when bpftool was compiled. Optional features include linking included when bpftool was compiled. Optional features include linking
against libbfd to provide the disassembler for JIT-ted programs against LLVM or libbfd to provide the disassembler for JIT-ted
(**bpftool prog dump jited**) and usage of BPF skeletons (some programs (**bpftool prog dump jited**) and usage of BPF skeletons
features like **bpftool prog profile** or showing pids associated to (some features like **bpftool prog profile** or showing pids
BPF objects may rely on it). associated to BPF objects may rely on it).
-j, --json -j, --json
Generate JSON output. For commands that cannot produce JSON, this Generate JSON output. For commands that cannot produce JSON, this
......
...@@ -119,6 +119,11 @@ static int do_version(int argc, char **argv) ...@@ -119,6 +119,11 @@ static int do_version(int argc, char **argv)
#else #else
const bool has_libbfd = false; const bool has_libbfd = false;
#endif #endif
#ifdef HAVE_LLVM_SUPPORT
const bool has_llvm = true;
#else
const bool has_llvm = false;
#endif
#ifdef BPFTOOL_WITHOUT_SKELETONS #ifdef BPFTOOL_WITHOUT_SKELETONS
const bool has_skeletons = false; const bool has_skeletons = false;
#else #else
...@@ -154,6 +159,7 @@ static int do_version(int argc, char **argv) ...@@ -154,6 +159,7 @@ static int do_version(int argc, char **argv)
jsonw_name(json_wtr, "features"); jsonw_name(json_wtr, "features");
jsonw_start_object(json_wtr); /* features */ jsonw_start_object(json_wtr); /* features */
jsonw_bool_field(json_wtr, "libbfd", has_libbfd); jsonw_bool_field(json_wtr, "libbfd", has_libbfd);
jsonw_bool_field(json_wtr, "llvm", has_llvm);
jsonw_bool_field(json_wtr, "libbpf_strict", !legacy_libbpf); jsonw_bool_field(json_wtr, "libbpf_strict", !legacy_libbpf);
jsonw_bool_field(json_wtr, "skeletons", has_skeletons); jsonw_bool_field(json_wtr, "skeletons", has_skeletons);
jsonw_bool_field(json_wtr, "bootstrap", bootstrap); jsonw_bool_field(json_wtr, "bootstrap", bootstrap);
...@@ -172,6 +178,7 @@ static int do_version(int argc, char **argv) ...@@ -172,6 +178,7 @@ static int do_version(int argc, char **argv)
printf("using libbpf %s\n", libbpf_version_string()); printf("using libbpf %s\n", libbpf_version_string());
printf("features:"); printf("features:");
print_feature("libbfd", has_libbfd, &nb_features); print_feature("libbfd", has_libbfd, &nb_features);
print_feature("llvm", has_llvm, &nb_features);
print_feature("libbpf_strict", !legacy_libbpf, &nb_features); print_feature("libbpf_strict", !legacy_libbpf, &nb_features);
print_feature("skeletons", has_skeletons, &nb_features); print_feature("skeletons", has_skeletons, &nb_features);
print_feature("bootstrap", bootstrap, &nb_features); print_feature("bootstrap", bootstrap, &nb_features);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册