Commit 17cba79f authored by Ben Hutchings's avatar Ben Hutchings

libbpf: Stop overriding upstream soname; rename shlib package to libbpf0

libbpf seems to be setting a proper soname and versioning symbols now.
Don't replace upstream's soversion with the kernel version.

Refresh "generate pkg-config file for libbpf" based on the upstream
version.
parent a30ab776
......@@ -16,6 +16,7 @@ linux (5.1.3-1~exp1) UNRELEASED; urgency=medium
* debian/rules.d/scripts/mod: Add uuid_t and UUID_STRING_LEN definitions
* liblockdep: Disable until it can be built again
* libcpupower: Bump soversion since 2 exported functions have been removed
* libbpf: Stop overriding upstream soname; rename shlib package to libbpf0
[ Vagrant Cascadian ]
* [arm64] Enable modules to support audio on pinebook: SND_SUN4I_I2S,
......
From: Hilko Bengen <bengen@debian.org>
Date: Sun, 02 Dec 2018 23:26:03 +0000
Subject: libbpf: add SONAME to shared object
tools/lib/bpf/libbpf: Add proper version to the shared object.
Add versioning to the shared object to make it easier on distros to
distribute the library without having to watch for API/ABI versioning.
This is similar to the change made to tools/lib/lockdep/Makefile in
be227b45fb228adff4371b8de9e3989904209ff4.
Signed-off-by: Hilko Bengen <bengen@debian.org>
[bwh: Forward-ported to 5.0]
---
tools/lib/bpf/Makefile | 24 ++++++++----------------
1 file changed, 8 insertions(+), 16 deletions(-)
diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
index 8e7c56e9590f..3cf843769826 100644
--- a/tools/lib/bpf/Makefile
+++ b/tools/lib/bpf/Makefile
@@ -1,10 +1,6 @@
# SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause)
# Most of this file is copied from tools/lib/traceevent/Makefile
-BPF_VERSION = 0
-BPF_PATCHLEVEL = 0
-BPF_EXTRAVERSION = 2
-
MAKEFLAGS += --no-print-directory
ifeq ($(srctree),)
@@ -79,17 +75,12 @@ export prefix libdir src obj
libdir_SQ = $(subst ','\'',$(libdir))
libdir_relative_SQ = $(subst ','\'',$(libdir_relative))
-VERSION = $(BPF_VERSION)
-PATCHLEVEL = $(BPF_PATCHLEVEL)
-EXTRAVERSION = $(BPF_EXTRAVERSION)
-
OBJ = $@
N =
-LIBBPF_VERSION = $(BPF_VERSION).$(BPF_PATCHLEVEL).$(BPF_EXTRAVERSION)
-
+LIBBPF_VERSION=$(shell make --no-print-directory -sC ../../.. kernelversion)
LIB_TARGET = libbpf.a libbpf.so.$(LIBBPF_VERSION)
-LIB_FILE = libbpf.a libbpf.so*
+LIB_FILE = libbpf.a libbpf.so.$(LIBBPF_VERSION)
# Set compile option CFLAGS
ifdef EXTRA_CFLAGS
@@ -137,7 +128,7 @@ LIB_FILE := $(addprefix $(OUTPUT),$(LIB_FILE))
GLOBAL_SYM_COUNT = $(shell readelf -s --wide $(BPF_IN) | \
awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {s++} END{print s}')
-VERSIONED_SYM_COUNT = $(shell readelf -s --wide $(OUTPUT)libbpf.so | \
+VERSIONED_SYM_COUNT = $(shell readelf -s --wide $(OUTPUT)libbpf.so.$(LIBBPF_VERSION) | \
grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | sort -u | wc -l)
CMD_TARGETS = $(LIB_TARGET)
@@ -176,10 +167,10 @@ $(BPF_IN): force elfdep bpfdep
$(OUTPUT)libbpf.so: $(OUTPUT)libbpf.so.$(LIBBPF_VERSION)
$(OUTPUT)libbpf.so.$(LIBBPF_VERSION): $(BPF_IN)
- $(QUIET_LINK)$(CC) --shared -Wl,-soname,libbpf.so.$(VERSION) \
+ $(QUIET_LINK)$(CC) --shared -Wl,-soname,libbpf.so.$(LIBBPF_VERSION) \
-Wl,--version-script=$(VERSION_SCRIPT) $^ -lelf -o $@
@ln -sf $(@F) $(OUTPUT)libbpf.so
- @ln -sf $(@F) $(OUTPUT)libbpf.so.$(VERSION)
+ @ln -sf $(@F) $(OUTPUT)libbpf.so.$(LIBBPF_VERSION)
$(OUTPUT)libbpf.a: $(BPF_IN)
$(QUIET_LINK)$(RM) $@; $(AR) rcs $@ $^
@@ -189,7 +180,7 @@ $(OUTPUT)test_libbpf: test_libbpf.cpp $(OUTPUT)libbpf.a
check: check_abi
-check_abi: $(OUTPUT)libbpf.so
+check_abi: $(OUTPUT)libbpf.so.$(LIBBPF_VERSION)
@if [ "$(GLOBAL_SYM_COUNT)" != "$(VERSIONED_SYM_COUNT)" ]; then \
echo "Warning: Num of global symbols in $(BPF_IN)" \
"($(GLOBAL_SYM_COUNT)) does NOT match with num of" \
@@ -216,6 +207,7 @@ install_lib: all_cmd
$(call QUIET_INSTALL, $(LIB_TARGET)) \
$(call do_install_mkdir,$(libdir_SQ)); \
cp -fpR $(LIB_FILE) $(DESTDIR)$(libdir_SQ)
+ $(Q)ln -sf libbpf.so.$(LIBBPF_VERSION) $(DESTDIR_SQ)$(libdir_SQ)/libbpf.so
install_headers:
$(call QUIET_INSTALL, headers) \
@@ -234,7 +226,7 @@ config-clean:
clean:
$(call QUIET_CLEAN, libbpf) $(RM) $(TARGETS) $(CXX_TEST_TARGET) \
- *.o *~ *.a *.so *.so.$(VERSION) .*.d .*.cmd LIBBPF-CFLAGS
+ *.o *~ *.a *.so *.so.$(LIBBPF_VERSION) .*.d .*.cmd LIBBPF-CFLAGS
$(call QUIET_CLEAN, core-gen) $(RM) $(OUTPUT)FEATURE-DUMP.libbpf
--
2.20.1
......@@ -9,13 +9,11 @@ Origin: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit/
Applied-Upstream: yes
---
tools/lib/bpf/.gitignore | 1 +
tools/lib/bpf/Makefile | 19 ++++++++++++++++---
tools/lib/bpf/Makefile | 18 +++++++++++++++---
tools/lib/bpf/libbpf.pc.template | 12 ++++++++++++
3 files changed, 29 insertions(+), 3 deletions(-)
3 files changed, 28 insertions(+), 3 deletions(-)
create mode 100644 tools/lib/bpf/libbpf.pc.template
diff --git a/tools/lib/bpf/.gitignore b/tools/lib/bpf/.gitignore
index fecb78afea3f..d9e9dec04605 100644
--- a/tools/lib/bpf/.gitignore
+++ b/tools/lib/bpf/.gitignore
@@ -1,4 +1,5 @@
......@@ -24,19 +22,17 @@ index fecb78afea3f..d9e9dec04605 100644
FEATURE-DUMP.libbpf
test_libbpf
libbpf.so.*
diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
index 3cf843769826..17c11901aaf0 100644
--- a/tools/lib/bpf/Makefile
+++ b/tools/lib/bpf/Makefile
@@ -81,6 +81,7 @@ N =
LIBBPF_VERSION=$(shell make --no-print-directory -sC ../../.. kernelversion)
@@ -90,6 +90,7 @@ LIBBPF_VERSION = $(BPF_VERSION).$(BPF_PA
LIB_TARGET = libbpf.a libbpf.so.$(LIBBPF_VERSION)
LIB_FILE = libbpf.a libbpf.so.$(LIBBPF_VERSION)
+PC_FILE = libbpf.pc
LIB_FILE = libbpf.a libbpf.so*
+PC_FILE = libbpf.pc
# Set compile option CFLAGS
ifdef EXTRA_CFLAGS
@@ -125,13 +126,14 @@ VERSION_SCRIPT := libbpf.map
@@ -134,13 +135,14 @@ VERSION_SCRIPT := libbpf.map
LIB_TARGET := $(addprefix $(OUTPUT),$(LIB_TARGET))
LIB_FILE := $(addprefix $(OUTPUT),$(LIB_FILE))
......@@ -44,15 +40,15 @@ index 3cf843769826..17c11901aaf0 100644
GLOBAL_SYM_COUNT = $(shell readelf -s --wide $(BPF_IN) | \
awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {s++} END{print s}')
VERSIONED_SYM_COUNT = $(shell readelf -s --wide $(OUTPUT)libbpf.so.$(LIBBPF_VERSION) | \
VERSIONED_SYM_COUNT = $(shell readelf -s --wide $(OUTPUT)libbpf.so | \
grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | sort -u | wc -l)
-CMD_TARGETS = $(LIB_TARGET)
+CMD_TARGETS = $(LIB_FILE) $(PC_FILE)
+CMD_TARGETS = $(LIB_TARGET) $(PC_FILE)
CXX_TEST_TARGET = $(OUTPUT)test_libbpf
@@ -178,6 +180,12 @@ $(OUTPUT)libbpf.a: $(BPF_IN)
@@ -187,6 +189,12 @@ $(OUTPUT)libbpf.a: $(BPF_IN)
$(OUTPUT)test_libbpf: test_libbpf.cpp $(OUTPUT)libbpf.a
$(QUIET_LINK)$(CXX) $(INCLUDES) $^ -lelf -o $@
......@@ -64,8 +60,8 @@ index 3cf843769826..17c11901aaf0 100644
+
check: check_abi
check_abi: $(OUTPUT)libbpf.so.$(LIBBPF_VERSION)
@@ -216,7 +224,12 @@ install_headers:
check_abi: $(OUTPUT)libbpf.so
@@ -224,7 +232,11 @@ install_headers:
$(call do_install,btf.h,$(prefix)/include/bpf,644); \
$(call do_install,xsk.h,$(prefix)/include/bpf,644);
......@@ -74,23 +70,19 @@ index 3cf843769826..17c11901aaf0 100644
+ $(call QUIET_INSTALL, $(PC_FILE)) \
+ $(call do_install,$(PC_FILE),$(libdir_SQ)/pkgconfig,644)
+
+
+install: install_lib install_pkgconfig
### Cleaning rules
@@ -226,7 +239,7 @@ config-clean:
@@ -234,7 +246,7 @@ config-clean:
clean:
$(call QUIET_CLEAN, libbpf) $(RM) $(TARGETS) $(CXX_TEST_TARGET) \
- *.o *~ *.a *.so *.so.$(LIBBPF_VERSION) .*.d .*.cmd LIBBPF-CFLAGS
+ *.o *~ *.a *.so *.so.$(LIBBPF_VERSION) .*.d .*.cmd *.pc LIBBPF-CFLAGS
- *.o *~ *.a *.so *.so.$(VERSION) .*.d .*.cmd LIBBPF-CFLAGS
+ *.o *~ *.a *.so *.so.$(VERSION) .*.d .*.cmd *.pc LIBBPF-CFLAGS
$(call QUIET_CLEAN, core-gen) $(RM) $(OUTPUT)FEATURE-DUMP.libbpf
diff --git a/tools/lib/bpf/libbpf.pc.template b/tools/lib/bpf/libbpf.pc.template
new file mode 100644
index 000000000000..ac17fcef2108
--- /dev/null
+++ b/tools/lib/bpf/libbpf.pc.template
@@ -0,0 +1,12 @@
......@@ -106,6 +98,3 @@ index 000000000000..ac17fcef2108
+Libs: -L${libdir} -lbpf
+Requires.private: libelf
+Cflags: -I${includedir}
--
2.20.1
......@@ -161,7 +161,6 @@ bugfix/all/cpupower-fix-checks-for-cpu-existence.patch
bugfix/all/tools-lib-api-fs-fs.c-fix-misuse-of-strncpy.patch
bugfix/all/usbip-fix-misuse-of-strncpy.patch
bugfix/x86/tools-x86_energy_perf_policy-fix-uninitialized-varia.patch
bugfix/all/libbpf-add-soname-to-shared-object.patch
bugfix/all/libbpf-generate-pkg-config.patch
# wireless: Disable regulatory.db direct loading (until we sort out signing)
......
......@@ -5,6 +5,9 @@ DEB_HOST_MULTIARCH := $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
# Catch use of missing kernel APIs early
CFLAGS += -Werror=implicit-function-declaration
# Don't let the kernel version override libbpf's version
undefine VERSION
MAKE_BPF := +$(MAKE) -C $(top_srcdir)/$(OUTDIR)
MAKE_BPF += prefix=/usr
MAKE_BPF += libdir_relative=lib/$(DEB_HOST_MULTIARCH)
......
......@@ -766,14 +766,15 @@ endif
build-libbpf: $(STAMPS_DIR)/build-tools-headers
$(call make-tools,tools/lib/bpf)
install-libbpf: DH_OPTIONS = -plibbpf$(VERSION) -plibbpf-dev
install-libbpf: DH_OPTIONS = $(addprefix -p,$(filter libbpf%,$(packages_enabled)))
install-libbpf: SHLIB_PACKAGE = $(filter-out libbpf-dev,$(filter libbpf%,$(packages_enabled)))
install-libbpf: DIR = $(CURDIR)/debian/libbpf-tmp
install-libbpf: build-libbpf
dh_testdir
dh_testroot
dh_prep
$(call make-tools,tools/lib/bpf) install DESTDIR=$(DIR)
env -u DH_OPTIONS dh_install -plibbpf$(VERSION) --sourcedir=$(DIR) \
env -u DH_OPTIONS dh_install -p$(SHLIB_PACKAGE) --sourcedir=$(DIR) \
'usr/lib/*/libbpf.so.*'
dh_install --sourcedir=$(DIR)
dh_installchangelogs
......@@ -783,8 +784,8 @@ endif
dh_strip
dh_compress
dh_fixperms
env -u DH_OPTIONS dh_makeshlibs -plibbpf$(VERSION) \
libbpf$(VERSION)
env -u DH_OPTIONS dh_makeshlibs -p$(SHLIB_PACKAGE) \
$(SHLIB_PACKAGE)
dh_installdeb
dh_shlibdeps
dh_gencontrol
......
......@@ -112,7 +112,7 @@ Description: Support daemons for Linux running on Hyper-V
# liblockdep is a library for programs that use the pthreads API, which can
# be used to detect actual and potential deadlocks and other locking bugs.
Package: libbpf@version@
Package: libbpf0
Build-Profiles: <!stage1 !pkg.linux.notools>
Architecture: alpha amd64 arm64 arm64ilp32 armel armhf hppa i386 mips mips64 mips64el mips64r6 mips64r6el mipsel mipsn32 mipsn32el mipsn32r6 mipsn32r6el mipsr6 mipsr6el powerpc powerpcspe ppc64 ppc64el riscv64 s390 s390x sh3 sh4 sparc sparc64 x32
Depends: ${shlibs:Depends}, ${misc:Depends}
......@@ -125,7 +125,7 @@ Description: eBPF helper library (shared library)
Package: libbpf-dev
Build-Profiles: <!stage1 !pkg.linux.notools>
Architecture: alpha amd64 arm64 arm64ilp32 armel armhf hppa i386 mips mips64 mips64el mips64r6 mips64r6el mipsel mipsn32 mipsn32el mipsn32r6 mipsn32r6el mipsr6 mipsr6el powerpc powerpcspe ppc64 ppc64el riscv64 s390 s390x sh3 sh4 sparc sparc64 x32
Depends: ${misc:Depends}, libbpf@version@ (= ${binary:Version})
Depends: ${misc:Depends}, libbpf0 (= ${binary:Version})
Section: libdevel
Multi-Arch: same
Description: eBPF helper library (development files)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment