[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CACdoK4LTgpcuS9Sgk6F-9=cP09aACxJN4iTXJ=39OohPcBKXAg@mail.gmail.com>
Date: Thu, 30 Jun 2022 21:03:41 +0100
From: Quentin Monnet <quentin@...valent.com>
To: Andrii Nakryiko <andrii.nakryiko@...il.com>
Cc: Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>,
Martin KaFai Lau <kafai@...com>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...nel.org>, bpf <bpf@...r.kernel.org>,
Networking <netdev@...r.kernel.org>,
Peter Wu <peter@...ensteyn.nl>
Subject: Re: [PATCH bpf-next] bpftool: Allow disabling features at compile time
On Thu, 30 Jun 2022 at 20:25, Andrii Nakryiko <andrii.nakryiko@...il.com> wrote:
>
> On Wed, Jun 29, 2022 at 7:40 AM Quentin Monnet <quentin@...valent.com> wrote:
> >
> > Some dependencies for bpftool are optional, and the associated features
> > may be left aside at compilation time depending on the available
> > components on the system (libraries, BTF, clang version, etc.).
> > Sometimes, it is useful to explicitly leave some of those features aside
> > when compiling, even though the system would support them. For example,
> > this can be useful:
> >
> > - for testing bpftool's behaviour when the feature is not present,
> > - for copmiling for a different system, where some libraries are
> > missing,
> > - for producing a lighter binary,
> > - for disabling features that do not compile correctly on older
> > systems - although this is not supposed to happen, this is
> > currently the case for skeletons support on Linux < 5.15, where
> > struct bpf_perf_link is not defined in kernel BTF.
> >
> > For such cases, we introduce, in the Makefile, some environment
> > variables that can be used to disable those features: namely,
> > BPFTOOL_FEATURE_NO_LIBBFD, BPFTOOL_FEATURE_NO_LIBCAP, and
> > BPFTOOL_FEATURE_NO_SKELETONS.
> >
> > Signed-off-by: Quentin Monnet <quentin@...valent.com>
> > ---
> > tools/bpf/bpftool/Makefile | 20 ++++++++++++++++++--
> > 1 file changed, 18 insertions(+), 2 deletions(-)
> >
> > diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile
> > index c19e0e4c41bd..b3dd6a1482f6 100644
> > --- a/tools/bpf/bpftool/Makefile
> > +++ b/tools/bpf/bpftool/Makefile
> > @@ -93,8 +93,24 @@ INSTALL ?= install
> > RM ?= rm -f
> >
> > FEATURE_USER = .bpftool
> > -FEATURE_TESTS = libbfd disassembler-four-args zlib libcap \
> > - clang-bpf-co-re
> > +FEATURE_TESTS := disassembler-four-args zlib
>
> as an aside, zlib is not really optional, libbpf depends on it and
> bpftool depends on libbpf, so... what's the point of a feature test?
I'm not sure either, it looks like it's mostly a way to print that the
lib is missing (when it's the case) before attempting to compile [0].
Probably something we can look into removing, I agree the feature test
doesn't bring much here. We'll soon need a new test for the latest
libbfd changes though [1].
[0] https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf.git/commit/?id=d66fa3c70e598746a907e5db5ed024035e01817a
[1] https://lore.kernel.org/bpf/20220622181918.ykrs5rsnmx3og4sv@alap3.anarazel.de/
Powered by blists - more mailing lists