From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stanislav Fomichev Subject: Re: [PATCH bpf v2] tools/bpf: properly account for libbfd variations Date: Tue, 15 Jan 2019 14:00:06 -0800 Message-ID: <20190115220006.GB726@mini-arch> References: <20190115133800.658999bd@cakuba.netronome.com> <20190115215248.57081-1-sdf@google.com> <20190115135510.0df374a1@cakuba.netronome.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Stanislav Fomichev , netdev@vger.kernel.org, davem@davemloft.net, ast@kernel.org, daniel@iogearbox.net, quentin.monnet@netronome.com To: Jakub Kicinski Return-path: Received: from mail-pf1-f193.google.com ([209.85.210.193]:33510 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730612AbfAOWAJ (ORCPT ); Tue, 15 Jan 2019 17:00:09 -0500 Received: by mail-pf1-f193.google.com with SMTP id c123so1973424pfb.0 for ; Tue, 15 Jan 2019 14:00:08 -0800 (PST) Content-Disposition: inline In-Reply-To: <20190115135510.0df374a1@cakuba.netronome.com> Sender: netdev-owner@vger.kernel.org List-ID: On 01/15, Jakub Kicinski wrote: > On Tue, 15 Jan 2019 13:52:48 -0800, Stanislav Fomichev wrote: > > On some platforms, in order to link against libbfd, we need to > > link against liberty and even possibly libz. Account for that > > in the bpftool Makefile. We now have proper feature detection > > for each case, so handle each one separately. > > > > See recent commit 14541b1e7e72 ("perf build: Don't unconditionally link the > > libbfd feature test to -liberty and -lz") where I fixed feature > > detection. > > > > v2 (addressed Jakub's nits): > > * better syntax for 'else ifeq' > > * no space between ifeq args > > > > Fixes: 29a9c10e4110 ("bpftool: make libbfd optional") > > Signed-off-by: Stanislav Fomichev > > --- > > tools/bpf/bpftool/Makefile | 9 ++++++++- > > 1 file changed, 8 insertions(+), 1 deletion(-) > > > > diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile > > index 492f0f24e2d3..fbf7e62a5b86 100644 > > --- a/tools/bpf/bpftool/Makefile > > +++ b/tools/bpf/bpftool/Makefile > > @@ -93,9 +93,16 @@ BFD_SRCS = jit_disasm.c > > SRCS = $(filter-out $(BFD_SRCS),$(wildcard *.c)) > > > > ifeq ($(feature-libbfd),1) > > + LIBS += -lbfd -ldl -lopcodes > > +else ifeq ($(feature-libbfd-liberty),1) > > + LIBS += -lbfd -ldl -lopcodes -liberty > > +else ifeq ($(feature-libbfd-liberty-z),1) > > + LIBS += -lbfd -ldl -lopcodes -liberty -lz > > +endif > > + > > +ifneq ($(filter -lbfd,$(EXTLIBS)),) > > Ah, I just noticed now that you use EXTLIBS here, not LIBS, is that on > purpose? Nice catch! Should be LIBS, probably copy-pasted it from somewhere :-( > > > CFLAGS += -DHAVE_LIBBFD_SUPPORT > > SRCS += $(BFD_SRCS) > > -LIBS += -lbfd -lopcodes > > endif > > > > OBJS = $(patsubst %.c,$(OUTPUT)%.o,$(SRCS)) $(OUTPUT)disasm.o >