netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf] tools/bpf: properly account for libbfd variations
@ 2019-01-15 19:59 Stanislav Fomichev
  2019-01-15 21:38 ` Jakub Kicinski
  0 siblings, 1 reply; 9+ messages in thread
From: Stanislav Fomichev @ 2019-01-15 19:59 UTC (permalink / raw)
  To: netdev
  Cc: davem, ast, daniel, jakub.kicinski, quentin.monnet,
	Stanislav Fomichev

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 <sdf@google.com>
---
 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

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-01-15 23:55 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-15 19:59 [PATCH bpf] tools/bpf: properly account for libbfd variations Stanislav Fomichev
2019-01-15 21:38 ` Jakub Kicinski
2019-01-15 21:47   ` Stanislav Fomichev
2019-01-15 21:52   ` [PATCH bpf v2] " Stanislav Fomichev
2019-01-15 21:55     ` Jakub Kicinski
2019-01-15 22:00       ` Stanislav Fomichev
2019-01-15 22:03       ` [PATCH bpf v3] " Stanislav Fomichev
2019-01-15 22:06         ` Jakub Kicinski
2019-01-15 23:55         ` Daniel Borkmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).