From: Quentin Monnet <quentin@isovalent.com>
To: Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>
Cc: "Martin KaFai Lau" <kafai@fb.com>,
"Song Liu" <songliubraving@fb.com>, "Yonghong Song" <yhs@fb.com>,
"John Fastabend" <john.fastabend@gmail.com>,
"KP Singh" <kpsingh@kernel.org>,
"Stanislav Fomichev" <sdf@google.com>,
"Hao Luo" <haoluo@google.com>, "Jiri Olsa" <jolsa@kernel.org>,
bpf@vger.kernel.org,
"Niklas Söderlund" <niklas.soderlund@corigine.com>,
"Simon Horman" <simon.horman@corigine.com>,
"Quentin Monnet" <quentin@isovalent.com>
Subject: [PATCH bpf-next 7/7] bpftool: Add llvm feature to "bpftool version"
Date: Tue, 6 Sep 2022 14:36:13 +0100 [thread overview]
Message-ID: <20220906133613.54928-8-quentin@isovalent.com> (raw)
In-Reply-To: <20220906133613.54928-1-quentin@isovalent.com>
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 with "libbfd".
Signed-off-by: Quentin Monnet <quentin@isovalent.com>
---
tools/bpf/bpftool/Documentation/common_options.rst | 8 ++++----
tools/bpf/bpftool/main.c | 10 ++++++++++
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/tools/bpf/bpftool/Documentation/common_options.rst b/tools/bpf/bpftool/Documentation/common_options.rst
index 4107a586b68b..05350a1aadf9 100644
--- a/tools/bpf/bpftool/Documentation/common_options.rst
+++ b/tools/bpf/bpftool/Documentation/common_options.rst
@@ -7,10 +7,10 @@
Print bpftool's version number (similar to **bpftool version**), the
number of the libbpf version in use, and optional features that were
included when bpftool was compiled. Optional features include linking
- against libbfd to provide the disassembler for JIT-ted programs
- (**bpftool prog dump jited**) and usage of BPF skeletons (some
- features like **bpftool prog profile** or showing pids associated to
- BPF objects may rely on it).
+ against LLVM or libbfd to provide the disassembler for JIT-ted
+ programs (**bpftool prog dump jited**) and usage of BPF skeletons
+ (some features like **bpftool prog profile** or showing pids
+ associated to BPF objects may rely on it).
-j, --json
Generate JSON output. For commands that cannot produce JSON, this
diff --git a/tools/bpf/bpftool/main.c b/tools/bpf/bpftool/main.c
index ccd7457f92bf..7e06ca2c5d42 100644
--- a/tools/bpf/bpftool/main.c
+++ b/tools/bpf/bpftool/main.c
@@ -89,6 +89,11 @@ static int do_version(int argc, char **argv)
#else
const bool has_libbfd = false;
#endif
+#ifdef HAVE_LLVM_SUPPORT
+ const bool has_llvm = true;
+#else
+ const bool has_llvm = false;
+#endif
#ifdef BPFTOOL_WITHOUT_SKELETONS
const bool has_skeletons = false;
#else
@@ -112,6 +117,7 @@ static int do_version(int argc, char **argv)
jsonw_name(json_wtr, "features");
jsonw_start_object(json_wtr); /* features */
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, "skeletons", has_skeletons);
jsonw_end_object(json_wtr); /* features */
@@ -132,6 +138,10 @@ static int do_version(int argc, char **argv)
printf(" libbfd");
nb_features++;
}
+ if (has_llvm) {
+ printf(" llvm");
+ nb_features++;
+ }
if (!legacy_libbpf) {
printf("%s libbpf_strict", nb_features++ ? "," : "");
nb_features++;
--
2.34.1
next prev parent reply other threads:[~2022-09-06 13:44 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Quentin Monnet [this message]
2022-09-10 19:41 ` [PATCH bpf-next 0/7] " Niklas Söderlund
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220906133613.54928-8-quentin@isovalent.com \
--to=quentin@isovalent.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kafai@fb.com \
--cc=kpsingh@kernel.org \
--cc=niklas.soderlund@corigine.com \
--cc=sdf@google.com \
--cc=simon.horman@corigine.com \
--cc=songliubraving@fb.com \
--cc=yhs@fb.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox