Re: [PATCH 0/3] perf/bpftool: Allow to link libbpf dynamically

Andrii Nakryiko
2019-12-02T17:09:50Z

On Wed, Nov 27, 2019 at 1:49 AM Jiri Olsa <jolsa@kernel.org> wrote:
>
> hi,
> adding support to link bpftool with libbpf dynamically,
> and config change for perf.
>
> It's now possible to use:
> $ make -C tools/bpf/bpftool/ LIBBPF_DYNAMIC=1

I wonder what's the motivation behind these changes, though? Why is
linking bpftool dynamically with libbpf is necessary and important?
They are both developed tightly within kernel repo, so I fail to see
what are the huge advantages one can get from linking them
dynamically.

>
> which will detect libbpf devel package with needed version,
> and if found, link it with bpftool.
>
> It's possible to use arbitrary installed libbpf:
> $ make -C tools/bpf/bpftool/ LIBBPF_DYNAMIC=1 LIBBPF_DIR=/tmp/libbpf/
>
> I based this change on top of Arnaldo's perf/core, because
> it contains libbpf feature detection code as dependency.
> It's now also synced with latest bpf-next, so Toke's change
> applies correctly.
>
> Also available in:
> git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
> libbpf/dyn
>
> thanks,
> jirka
>
>
> ---
> Jiri Olsa (2):
> perf tools: Allow to specify libbpf install directory
> bpftool: Allow to link libbpf dynamically
>
> Toke Høiland-Jørgensen (1):
> libbpf: Export netlink functions used by bpftool
>
> tools/bpf/bpftool/Makefile | 40 +++++++++++++++++++++++++++++++++++++++-
> tools/build/feature/test-libbpf.c | 9 +++++++++
> tools/lib/bpf/libbpf.h | 22 +++++++++++++---------
> tools/lib/bpf/libbpf.map | 7 +++++++
> tools/lib/bpf/nlattr.h | 15 ++++++++++-----
> tools/perf/Makefile.config | 27 ++++++++++++++++++++-------
> 6 files changed, 98 insertions(+), 22 deletions(-)
>