Revert "iproute2: simplify linking libelf for eBFP/XDP object file support"
authorHans Dedecker <dedeckeh@gmail.com>
Tue, 19 Feb 2019 14:14:42 +0000 (15:14 +0100)
committerHans Dedecker <dedeckeh@gmail.com>
Tue, 19 Feb 2019 14:22:28 +0000 (15:22 +0100)
This reverts commit 26681fa6a6fcbec0024906eb8367e9a3160521fb as it breaks the
installation of the iproute2 utilities ip-bridge, ss, nstat, devlink and rdma
for the ip-full variant

Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
package/network/utils/iproute2/Makefile
package/network/utils/iproute2/patches/145-keep_libelf_optional.patch [deleted file]
package/network/utils/iproute2/patches/190-link-libelf-to-tc-only.patch [new file with mode: 0644]

index a9bcfd40a033ce6757b4f6e37ec61f06652220bb..56a16d095c7c679d504fe02afba7b3b0c2f30360 100644 (file)
@@ -49,7 +49,7 @@ $(call Package/iproute2/Default)
  VARIANT:=full
  PROVIDES:=ip
  ALTERNATIVES:=300:/sbin/ip:/usr/libexec/ip-full
- DEPENDS:=+libnl-tiny +libelf +(PACKAGE_devlink||PACKAGE_rdma):libmnl
+ DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl
 endef
 
 define Package/tc
@@ -100,14 +100,6 @@ ifeq ($(BUILD_VARIANT),tiny)
   IP_CONFIG_TINY:=y
 endif
 
-ifeq ($(BUILD_VARIANT),full)
-  HAVE_ELF:=y
-endif
-
-ifeq ($(BUILD_VARIANT),tc)
-  HAVE_ELF:=y
-endif
-
 ifdef CONFIG_PACKAGE_devlink
   HAVE_MNL:=y
 endif
@@ -129,7 +121,6 @@ MAKE_FLAGS += \
        KERNEL_INCLUDE="$(LINUX_DIR)/user_headers/include" \
        SHARED_LIBS="" \
        IP_CONFIG_TINY=$(IP_CONFIG_TINY) \
-       HAVE_ELF=$(HAVE_ELF) \
        HAVE_MNL=$(HAVE_MNL) \
        IPT_LIB_DIR=/usr/lib/iptables \
        XT_LIB_DIR=/usr/lib/iptables \
diff --git a/package/network/utils/iproute2/patches/145-keep_libelf_optional.patch b/package/network/utils/iproute2/patches/145-keep_libelf_optional.patch
deleted file mode 100644 (file)
index 2e3ad18..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/configure
-+++ b/configure
-@@ -228,7 +228,7 @@ EOF
- check_elf()
- {
--    if ${PKG_CONFIG} libelf --exists; then
-+    if [ "${HAVE_ELF}" = "y" ] && ${PKG_CONFIG} libelf --exists; then
-       echo "HAVE_ELF:=y" >>$CONFIG
-       echo "yes"
diff --git a/package/network/utils/iproute2/patches/190-link-libelf-to-tc-only.patch b/package/network/utils/iproute2/patches/190-link-libelf-to-tc-only.patch
new file mode 100644 (file)
index 0000000..31aacff
--- /dev/null
@@ -0,0 +1,60 @@
+--- a/configure
++++ b/configure
+@@ -231,8 +231,9 @@ check_elf()
+       echo "HAVE_ELF:=y" >>$CONFIG
+       echo "yes"
+-      echo 'CFLAGS += -DHAVE_ELF' `${PKG_CONFIG} libelf --cflags` >> $CONFIG
+-      echo 'LDLIBS += ' `${PKG_CONFIG} libelf --libs` >>$CONFIG
++      echo 'CFLAGS += -DHAVE_ELF' >> $CONFIG
++      echo 'ELF_CFLAGS += ' `${PKG_CONFIG} libelf --cflags` >> $CONFIG
++      echo 'ELF_LDLIBS += ' `${PKG_CONFIG} libelf --libs` >>$CONFIG
+     else
+       echo "no"
+     fi
+--- a/lib/Makefile
++++ b/lib/Makefile
+@@ -11,9 +11,17 @@ UTILOBJ = utils.o rt_names.o ll_map.o ll
+       inet_proto.o namespace.o json_writer.o json_print.o \
+       names.o color.o bpf.o exec.o fs.o
++ELFOBJ=$(patsubst %.o,%.elf.o,$(UTILOBJ))
++
+ NLOBJ=libgenl.o libnetlink.o
+-all: libnetlink.a libutil.a
++all: libnetlink.a libutil.a libutil-elf.a
++
++%.o: %.c
++      $(QUIET_CC)$(CC) $(CFLAGS) -UHAVE_ELF $(EXTRA_CFLAGS) -c -o $@ $<
++
++%.elf.o: %.c
++      $(QUIET_CC)$(CC) $(CFLAGS) $(ELF_CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
+ libnetlink.a: $(NLOBJ)
+       $(QUIET_AR)$(AR) rcs $@ $^
+@@ -21,7 +29,10 @@ libnetlink.a: $(NLOBJ)
+ libutil.a: $(UTILOBJ) $(ADDLIB)
+       $(QUIET_AR)$(AR) rcs $@ $^
++libutil-elf.a: $(ELFOBJ) $(ADDLIB)
++      $(QUIET_AR)$(AR) rcs $@ $^
++
+ install:
+ clean:
+-      rm -f $(NLOBJ) $(UTILOBJ) $(ADDLIB) libnetlink.a libutil.a
++      rm -f $(NLOBJ) $(UTILOBJ) $(ELFOBJ) $(ADDLIB) libnetlink.a libutil.a libutil-elf.a
+--- a/tc/Makefile
++++ b/tc/Makefile
+@@ -133,8 +133,8 @@ MODDESTDIR := $(DESTDIR)$(LIBDIR)/tc
+ all: tc $(TCSO)
+-tc: $(TCOBJ) $(LIBNETLINK) libtc.a
+-      $(QUIET_LINK)$(CC) $^ $(LDFLAGS) $(LDLIBS) -o $@
++tc: $(TCOBJ) $(subst libutil.a,libutil-elf.a,$(LIBNETLINK)) libtc.a
++      $(QUIET_LINK)$(CC) $^ $(LDFLAGS) $(LDLIBS) $(ELF_LDLIBS) -o $@
+ libtc.a: $(TCLIB)
+       $(QUIET_AR)$(AR) rcs $@ $^