From 8cc360fe483d028ec39ec2b74ba18a7b95f4520e Mon Sep 17 00:00:00 2001 From: Daniel Borkmann Date: Thu, 10 Aug 2017 00:15:41 +0200 Subject: [PATCH] bpf: unbreak libelf linkage for bpf obj loader Commit 69fed534a533 ("change how Config is used in Makefile's") moved HAVE_MNL specific CFLAGS/LDLIBS for building with libmnl out of the top level Makefile into sub-Makefiles. However, it also removed the HAVE_ELF specific CFLAGS/LDLIBS entirely, which breaks the BPF object loader for tc and ip with "No ELF library support compiled in." despite having libelf detected in configure script. Fix it similarly as in 69fed534a533 for HAVE_ELF. Fixes: 69fed534a533 ("change how Config is used in Makefile's") Reported-by: Jeffrey Panneman Signed-off-by: Daniel Borkmann --- ip/Makefile | 4 ++++ lib/Makefile | 4 ++++ tc/Makefile | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/ip/Makefile b/ip/Makefile index 572604d5f..a754c04d2 100644 --- a/ip/Makefile +++ b/ip/Makefile @@ -19,6 +19,10 @@ ifeq ($(IP_CONFIG_SETNS),y) CFLAGS += -DHAVE_SETNS endif +ifeq ($(HAVE_ELF),y) + CFLAGS += -DHAVE_ELF + LDLIBS += -lelf +endif ifeq ($(HAVE_MNL),y) CFLAGS += -DHAVE_LIBMNL $(shell $(PKG_CONFIG) libmnl --cflags) LDLIBS += $(shell $(PKG_CONFIG) libmnl --libs) diff --git a/lib/Makefile b/lib/Makefile index 637fe4873..b7b1d5685 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -4,6 +4,10 @@ ifeq ($(IP_CONFIG_SETNS),y) CFLAGS += -DHAVE_SETNS endif +ifeq ($(HAVE_ELF),y) + CFLAGS += -DHAVE_ELF +endif + ifeq ($(HAVE_MNL),y) CFLAGS += -DHAVE_LIBMNL $(shell $(PKG_CONFIG) libmnl --cflags) endif diff --git a/tc/Makefile b/tc/Makefile index c364a053e..a9b4b8e60 100644 --- a/tc/Makefile +++ b/tc/Makefile @@ -102,6 +102,10 @@ endif TCOBJ += $(TCMODULES) LDLIBS += -L. -lm +ifeq ($(HAVE_ELF),y) + CFLAGS += -DHAVE_ELF + LDLIBS += -lelf +endif ifeq ($(HAVE_MNL),y) CFLAGS += -DHAVE_LIBMNL $(shell $(PKG_CONFIG) libmnl --cflags) LDLIBS += $(shell $(PKG_CONFIG) libmnl --libs) -- 2.47.2