Merge branch 'libbpf-fixup'
Daniel Borkmann says: ==================== First one is fixing version in Makefile and shared object and second one clarifies bump in version. Thanks! v1 -> v2: - Fix up soname, thanks Stanislav! ==================== Signed-off-by: Alexei Starovoitov <ast@kernel.org>
This commit is contained in:
commit
a7d6ac3761
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
BPF_VERSION = 0
|
BPF_VERSION = 0
|
||||||
BPF_PATCHLEVEL = 0
|
BPF_PATCHLEVEL = 0
|
||||||
BPF_EXTRAVERSION = 1
|
BPF_EXTRAVERSION = 2
|
||||||
|
|
||||||
MAKEFLAGS += --no-print-directory
|
MAKEFLAGS += --no-print-directory
|
||||||
|
|
||||||
@ -79,8 +79,6 @@ export prefix libdir src obj
|
|||||||
libdir_SQ = $(subst ','\'',$(libdir))
|
libdir_SQ = $(subst ','\'',$(libdir))
|
||||||
libdir_relative_SQ = $(subst ','\'',$(libdir_relative))
|
libdir_relative_SQ = $(subst ','\'',$(libdir_relative))
|
||||||
|
|
||||||
LIB_FILE = libbpf.a libbpf.so
|
|
||||||
|
|
||||||
VERSION = $(BPF_VERSION)
|
VERSION = $(BPF_VERSION)
|
||||||
PATCHLEVEL = $(BPF_PATCHLEVEL)
|
PATCHLEVEL = $(BPF_PATCHLEVEL)
|
||||||
EXTRAVERSION = $(BPF_EXTRAVERSION)
|
EXTRAVERSION = $(BPF_EXTRAVERSION)
|
||||||
@ -88,7 +86,10 @@ EXTRAVERSION = $(BPF_EXTRAVERSION)
|
|||||||
OBJ = $@
|
OBJ = $@
|
||||||
N =
|
N =
|
||||||
|
|
||||||
LIBBPF_VERSION = $(BPF_VERSION).$(BPF_PATCHLEVEL).$(BPF_EXTRAVERSION)
|
LIBBPF_VERSION = $(BPF_VERSION).$(BPF_PATCHLEVEL).$(BPF_EXTRAVERSION)
|
||||||
|
|
||||||
|
LIB_TARGET = libbpf.a libbpf.so.$(LIBBPF_VERSION)
|
||||||
|
LIB_FILE = libbpf.a libbpf.so*
|
||||||
|
|
||||||
# Set compile option CFLAGS
|
# Set compile option CFLAGS
|
||||||
ifdef EXTRA_CFLAGS
|
ifdef EXTRA_CFLAGS
|
||||||
@ -128,16 +129,18 @@ all:
|
|||||||
export srctree OUTPUT CC LD CFLAGS V
|
export srctree OUTPUT CC LD CFLAGS V
|
||||||
include $(srctree)/tools/build/Makefile.include
|
include $(srctree)/tools/build/Makefile.include
|
||||||
|
|
||||||
BPF_IN := $(OUTPUT)libbpf-in.o
|
BPF_IN := $(OUTPUT)libbpf-in.o
|
||||||
LIB_FILE := $(addprefix $(OUTPUT),$(LIB_FILE))
|
VERSION_SCRIPT := libbpf.map
|
||||||
VERSION_SCRIPT := libbpf.map
|
|
||||||
|
LIB_TARGET := $(addprefix $(OUTPUT),$(LIB_TARGET))
|
||||||
|
LIB_FILE := $(addprefix $(OUTPUT),$(LIB_FILE))
|
||||||
|
|
||||||
GLOBAL_SYM_COUNT = $(shell readelf -s --wide $(BPF_IN) | \
|
GLOBAL_SYM_COUNT = $(shell readelf -s --wide $(BPF_IN) | \
|
||||||
awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {s++} END{print s}')
|
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 | \
|
||||||
grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | sort -u | wc -l)
|
grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | sort -u | wc -l)
|
||||||
|
|
||||||
CMD_TARGETS = $(LIB_FILE)
|
CMD_TARGETS = $(LIB_TARGET)
|
||||||
|
|
||||||
CXX_TEST_TARGET = $(OUTPUT)test_libbpf
|
CXX_TEST_TARGET = $(OUTPUT)test_libbpf
|
||||||
|
|
||||||
@ -170,9 +173,13 @@ $(BPF_IN): force elfdep bpfdep
|
|||||||
echo "Warning: Kernel ABI header at 'tools/include/uapi/linux/if_xdp.h' differs from latest version at 'include/uapi/linux/if_xdp.h'" >&2 )) || true
|
echo "Warning: Kernel ABI header at 'tools/include/uapi/linux/if_xdp.h' differs from latest version at 'include/uapi/linux/if_xdp.h'" >&2 )) || true
|
||||||
$(Q)$(MAKE) $(build)=libbpf
|
$(Q)$(MAKE) $(build)=libbpf
|
||||||
|
|
||||||
$(OUTPUT)libbpf.so: $(BPF_IN)
|
$(OUTPUT)libbpf.so: $(OUTPUT)libbpf.so.$(LIBBPF_VERSION)
|
||||||
$(QUIET_LINK)$(CC) --shared -Wl,--version-script=$(VERSION_SCRIPT) \
|
|
||||||
$^ -o $@
|
$(OUTPUT)libbpf.so.$(LIBBPF_VERSION): $(BPF_IN)
|
||||||
|
$(QUIET_LINK)$(CC) --shared -Wl,-soname,libbpf.so.$(VERSION) \
|
||||||
|
-Wl,--version-script=$(VERSION_SCRIPT) $^ -o $@
|
||||||
|
@ln -sf $(@F) $(OUTPUT)libbpf.so
|
||||||
|
@ln -sf $(@F) $(OUTPUT)libbpf.so.$(VERSION)
|
||||||
|
|
||||||
$(OUTPUT)libbpf.a: $(BPF_IN)
|
$(OUTPUT)libbpf.a: $(BPF_IN)
|
||||||
$(QUIET_LINK)$(RM) $@; $(AR) rcs $@ $^
|
$(QUIET_LINK)$(RM) $@; $(AR) rcs $@ $^
|
||||||
@ -192,6 +199,12 @@ check_abi: $(OUTPUT)libbpf.so
|
|||||||
exit 1; \
|
exit 1; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
define do_install_mkdir
|
||||||
|
if [ ! -d '$(DESTDIR_SQ)$1' ]; then \
|
||||||
|
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$1'; \
|
||||||
|
fi
|
||||||
|
endef
|
||||||
|
|
||||||
define do_install
|
define do_install
|
||||||
if [ ! -d '$(DESTDIR_SQ)$2' ]; then \
|
if [ ! -d '$(DESTDIR_SQ)$2' ]; then \
|
||||||
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$2'; \
|
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$2'; \
|
||||||
@ -200,8 +213,9 @@ define do_install
|
|||||||
endef
|
endef
|
||||||
|
|
||||||
install_lib: all_cmd
|
install_lib: all_cmd
|
||||||
$(call QUIET_INSTALL, $(LIB_FILE)) \
|
$(call QUIET_INSTALL, $(LIB_TARGET)) \
|
||||||
$(call do_install,$(LIB_FILE),$(libdir_SQ))
|
$(call do_install_mkdir,$(libdir_SQ)); \
|
||||||
|
cp -fpR $(LIB_FILE) $(DESTDIR)$(libdir_SQ)
|
||||||
|
|
||||||
install_headers:
|
install_headers:
|
||||||
$(call QUIET_INSTALL, headers) \
|
$(call QUIET_INSTALL, headers) \
|
||||||
@ -219,7 +233,7 @@ config-clean:
|
|||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(call QUIET_CLEAN, libbpf) $(RM) $(TARGETS) $(CXX_TEST_TARGET) \
|
$(call QUIET_CLEAN, libbpf) $(RM) $(TARGETS) $(CXX_TEST_TARGET) \
|
||||||
*.o *~ *.a *.so .*.d .*.cmd LIBBPF-CFLAGS
|
*.o *~ *.a *.so *.so.$(VERSION) .*.d .*.cmd LIBBPF-CFLAGS
|
||||||
$(call QUIET_CLEAN, core-gen) $(RM) $(OUTPUT)FEATURE-DUMP.libbpf
|
$(call QUIET_CLEAN, core-gen) $(RM) $(OUTPUT)FEATURE-DUMP.libbpf
|
||||||
|
|
||||||
|
|
||||||
|
@ -111,6 +111,7 @@ starting from ``0.0.1``.
|
|||||||
|
|
||||||
Every time ABI is being changed, e.g. because a new symbol is added or
|
Every time ABI is being changed, e.g. because a new symbol is added or
|
||||||
semantic of existing symbol is changed, ABI version should be bumped.
|
semantic of existing symbol is changed, ABI version should be bumped.
|
||||||
|
This bump in ABI version is at most once per kernel development cycle.
|
||||||
|
|
||||||
For example, if current state of ``libbpf.map`` is:
|
For example, if current state of ``libbpf.map`` is:
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user