Thread (18 messages) flat view 18 messages, 4 authors, 2021-03-13

Re: [PATCH bpf-next 07/10] bpftool: add `gen bpfo` command to perform BPF static linking

From: Quentin Monnet <hidden>
Date: 2021-03-13 21:32:21
Also in: bpf

On Sat, 13 Mar 2021 at 18:37, Andrii Nakryiko [off-list ref] wrote:
On Fri, Mar 12, 2021 at 10:07 AM Quentin Monnet [off-list ref] wrote:
quoted
2021-03-11 10:45 UTC-0800 ~ Andrii Nakryiko [off-list ref]
quoted
On Thu, Mar 11, 2021 at 3:31 AM Quentin Monnet [off-list ref] wrote:
quoted
2021-03-09 20:04 UTC-0800 ~ Andrii Nakryiko [off-list ref]
quoted
Add `bpftool gen bpfo <output-file> <input_file>...` command to statically
link multiple BPF object files into a single output BPF object file.

Similarly to existing '*.o' convention, bpftool is establishing a '*.bpfo'
convention for statically-linked BPF object files. Both .o and .bpfo suffixes
will be stripped out during BPF skeleton generation to infer BPF object name.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
---
 tools/bpf/bpftool/gen.c | 46 ++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 45 insertions(+), 1 deletion(-)
diff --git a/tools/bpf/bpftool/gen.c b/tools/bpf/bpftool/gen.c
index 4033c46d83e7..8b1ed6c0a62f 100644
--- a/tools/bpf/bpftool/gen.c
+++ b/tools/bpf/bpftool/gen.c
quoted
quoted
quoted
quoted
@@ -611,6 +654,7 @@ static int do_help(int argc, char **argv)

 static const struct cmd cmds[] = {
      { "skeleton",   do_skeleton },
+     { "bpfo",       do_bpfo },
      { "help",       do_help },
      { 0 }
 };
Please update the usage help message, man page, and bash completion,
thanks. Especially because what "bpftool gen bpfo" does is not intuitive
(but I don't have a better name suggestion at the moment).
Yeah, forgot about manpage and bash completions, as usual.

re: "gen bpfo". I don't have much better naming as well. `bpftool
link` is already taken for bpf_link-related commands. It felt like
keeping this under "gen" command makes sense. But maybe `bpftool
linker link <out> <in1> <in2> ...` would be a bit less confusing
convention?
"bpftool linker" would have been nice, but having "bpftool link", I
think it would be even more confusing. We can pass commands by their
prefixes, so is "bpftool link" the command "link" or a prefix for
"linker"? (I know it would be easy to sort out from our point of view,
but for regular users I'm sure that would be confusing).
right
quoted
I don't mind leaving it under "bpftool gen", it's probably the most
relevant command we have. As for replacing the "bpfo" keyword, I've
thought of "combined", "static_linked", "archive", "concat". I write
them in case it's any inspiration, but I find none of them ideal :/.
How about "bpftool gen object", which can be shortened in typing to
just `bpftool gen obj`. It seems complementary to `gen skeleton`. You
first generate object (from other objects generated by compiler, which
might be a bit confusing at first), then you generate skeleton from
the object. WDYT?
Sounds good, better than "bpfo" I think.

Quentin
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help