[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191129081251.GA14169@krava>
Date: Fri, 29 Nov 2019 09:12:51 +0100
From: Jiri Olsa <jolsa@...hat.com>
To: Toke Høiland-Jørgensen <toke@...hat.com>
Cc: Daniel Borkmann <daniel@...earbox.net>,
Alexei Starovoitov <alexei.starovoitov@...il.com>,
Jiri Olsa <jolsa@...nel.org>,
lkml <linux-kernel@...r.kernel.org>, netdev@...r.kernel.org,
bpf@...r.kernel.org, Ingo Molnar <mingo@...nel.org>,
Namhyung Kim <namhyung@...nel.org>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Michael Petlan <mpetlan@...hat.com>,
Jesper Dangaard Brouer <brouer@...hat.com>,
Martin KaFai Lau <kafai@...com>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
Andrii Nakryiko <andriin@...com>,
Arnaldo Carvalho de Melo <acme@...nel.org>
Subject: Re: [PATCH bpf v3] bpftool: Allow to link libbpf dynamically
On Thu, Nov 28, 2019 at 05:07:12PM +0100, Toke Høiland-Jørgensen wrote:
SNIP
> ifeq ($(srctree),)
> srctree := $(patsubst %/,%,$(dir $(CURDIR)))
> @@ -63,6 +72,19 @@ RM ?= rm -f
> FEATURE_USER = .bpftool
> FEATURE_TESTS = libbfd disassembler-four-args reallocarray zlib
> FEATURE_DISPLAY = libbfd disassembler-four-args zlib
> +ifdef LIBBPF_DYNAMIC
> + FEATURE_TESTS += libbpf
> + FEATURE_DISPLAY += libbpf
> +
> + # for linking with debug library run:
> + # make LIBBPF_DYNAMIC=1 LIBBPF_DIR=/opt/libbpf
> + ifdef LIBBPF_DIR
> + LIBBPF_CFLAGS := -I$(LIBBPF_DIR)/include
> + LIBBPF_LDFLAGS := -L$(LIBBPF_DIR)/$(libdir_relative)
> + FEATURE_CHECK_CFLAGS-libbpf := $(LIBBPF_CFLAGS)
> + FEATURE_CHECK_LDFLAGS-libbpf := $(LIBBPF_LDFLAGS)
> + endif
> +endif
>
> check_feat := 1
> NON_CHECK_FEAT_TARGETS := clean uninstall doc doc-clean doc-install doc-uninstall
> @@ -88,6 +110,18 @@ ifeq ($(feature-reallocarray), 0)
> CFLAGS += -DCOMPAT_NEED_REALLOCARRAY
> endif
>
> +ifdef LIBBPF_DYNAMIC
> + ifeq ($(feature-libbpf), 1)
> + # bpftool uses non-exported functions from libbpf, so just add the dynamic
> + # version of libbpf and let the linker figure it out
> + LIBS := -lbpf $(LIBS)
nice, so linker will pick up the missing symbols and we
don't need to check on particular libbpf version then
thanks,
jirka
> + CFLAGS += $(LIBBPF_CFLAGS)
> + LDFLAGS += $(LIBBPF_LDFLAGS)
> + else
> + dummy := $(error Error: No libbpf devel library found, please install libbpf-devel or libbpf-dev.)
> + endif
> +endif
> +
> include $(wildcard $(OUTPUT)*.d)
>
> all: $(OUTPUT)bpftool
> --
> 2.24.0
>
Powered by blists - more mailing lists