From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stanislav Fomichev Subject: [PATCH bpf] tools/bpf: properly account for libbfd variations Date: Tue, 15 Jan 2019 11:59:53 -0800 Message-ID: <20190115195953.238574-1-sdf@google.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Cc: davem@davemloft.net, ast@kernel.org, daniel@iogearbox.net, jakub.kicinski@netronome.com, quentin.monnet@netronome.com, Stanislav Fomichev To: netdev@vger.kernel.org Return-path: Received: from mail-pf1-f201.google.com ([209.85.210.201]:53668 "EHLO mail-pf1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389574AbfAOT75 (ORCPT ); Tue, 15 Jan 2019 14:59:57 -0500 Received: by mail-pf1-f201.google.com with SMTP id 82so2738288pfs.20 for ; Tue, 15 Jan 2019 11:59:57 -0800 (PST) Sender: netdev-owner@vger.kernel.org List-ID: 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. Fixes: 29a9c10e4110 ("bpftool: make libbfd optional") Signed-off-by: Stanislav Fomichev --- tools/bpf/bpftool/Makefile | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile index 492f0f24e2d3..af9a25bf480d 100644 --- a/tools/bpf/bpftool/Makefile +++ b/tools/bpf/bpftool/Makefile @@ -92,10 +92,21 @@ BFD_SRCS = jit_disasm.c SRCS = $(filter-out $(BFD_SRCS),$(wildcard *.c)) -ifeq ($(feature-libbfd),1) +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 + endif +endif + +ifneq ($(filter -lbfd,$(EXTLIBS)),) CFLAGS += -DHAVE_LIBBFD_SUPPORT SRCS += $(BFD_SRCS) -LIBS += -lbfd -lopcodes endif OBJS = $(patsubst %.c,$(OUTPUT)%.o,$(SRCS)) $(OUTPUT)disasm.o -- 2.20.1.97.g81188d93c3-goog