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

From: Alexei Starovoitov
Date: Wed Nov 27 2019 - 11:41:53 EST


On Wed, Nov 27, 2019 at 1:49 AM Jiri Olsa <jolsa@xxxxxxxxxx> wrote:
>
> diff --git a/tools/build/feature/test-libbpf.c b/tools/build/feature/test-libbpf.c
> index a508756cf4cc..93566d105a64 100644
> --- a/tools/build/feature/test-libbpf.c
> +++ b/tools/build/feature/test-libbpf.c
> @@ -3,5 +3,14 @@
>
> int main(void)
> {
> +#ifdef BPFTOOL
> + /*
> + * libbpf_netlink_open (LIBBPF_0.0.6) is the latest
> + * we need for bpftool at the moment
> + */
> + libbpf_netlink_open(NULL);
> + return 0;
> +#else
> return bpf_object__open("test") ? 0 : -1;
> +#endif

Such hack should be a clear sign that it's not appropriate for libbpf to
be public netlink api library. Few functions that it already has are for
libbpf and bpftool internal usage only.