aboutsummaryrefslogtreecommitdiffstats
path: root/package/network/utils
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2018-12-19 09:50:05 +0100
committerJo-Philipp Wich <jo@mein.io>2018-12-19 10:50:02 +0100
commit386803a006edafd54cef20b4b99b033b1b52cf5c (patch)
tree386a347b0c00041430c64184b712d24ea62a559e /package/network/utils
parent4b4e6a04ac918d5cce2d168d9e656f3d2a29ec4b (diff)
downloadupstream-386803a006edafd54cef20b4b99b033b1b52cf5c.tar.gz
upstream-386803a006edafd54cef20b4b99b033b1b52cf5c.tar.bz2
upstream-386803a006edafd54cef20b4b99b033b1b52cf5c.zip
iproute2: only link libelf where needed
The iproute2 build system links libelf support to every utility while only the tc program actually requires libelf specific functionality. Unfortunately the BPF ELF functionality is not confined into an own compilation unit but added to the existing bpf.c sources of the shared static libutil.a, causing every iproute2 applet to pick up an implicit libelf.so dependency. In order to avoid this requirement, patch the iproute2 build system to create both a libutil.a and a libutil-elf.a, with the former being built without libelf functionality and to only link the tc applet with the libelf enabled libutil. Finally, make the tc package depend on libelf to solve compilation errors. Ref: https://github.com/openwrt/packages/issues/7728 Fixes: FS#2011 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'package/network/utils')
-rw-r--r--package/network/utils/iproute2/Makefile4
-rw-r--r--package/network/utils/iproute2/patches/190-link-libelf-to-tc-only.patch60
2 files changed, 62 insertions, 2 deletions
diff --git a/package/network/utils/iproute2/Makefile b/package/network/utils/iproute2/Makefile
index 6d3305b5ad..5e0f19a644 100644
--- a/package/network/utils/iproute2/Makefile
+++ b/package/network/utils/iproute2/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=iproute2
PKG_VERSION:=4.19.0
-PKG_RELEASE:=6
+PKG_RELEASE:=7
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=@KERNEL/linux/utils/net/iproute2
@@ -53,7 +53,7 @@ endef
define Package/tc
$(call Package/iproute2/Default)
TITLE:=Traffic control utility
- DEPENDS:=+kmod-sched-core +(PACKAGE_devlink||PACKAGE_rdma):libmnl
+ DEPENDS:=+kmod-sched-core +(PACKAGE_devlink||PACKAGE_rdma):libmnl +libelf1
endef
define Package/genl
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
index 0000000000..1c44616253
--- /dev/null
+++ b/package/network/utils/iproute2/patches/190-link-libelf-to-tc-only.patch
@@ -0,0 +1,60 @@
+--- a/configure
++++ b/configure
+@@ -257,8 +257,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
+@@ -132,8 +132,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 $@ $^