mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 01:40:53 +07:00
libbpf: Re-build libbpf.so when libbpf.map changes
[ Upstream commit 61c7aa5020e98ac2fdcf07d07eec1baf2e9f0a08 ]
Ensure libbpf.so is re-built whenever libbpf.map is modified. Without this,
changes to libbpf.map are not detected and versioned symbols mismatch error
will be reported until `make clean && make` is used, which is a suboptimal
developer experience.
Fixes: 306b267cb3
("libbpf: Verify versioned symbols")
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Yonghong Song <yhs@fb.com>
Link: https://lore.kernel.org/bpf/20210815070609.987780-8-andrii@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
824036abae
commit
31849b3732
@ -4,8 +4,9 @@
|
|||||||
RM ?= rm
|
RM ?= rm
|
||||||
srctree = $(abs_srctree)
|
srctree = $(abs_srctree)
|
||||||
|
|
||||||
|
VERSION_SCRIPT := libbpf.map
|
||||||
LIBBPF_VERSION := $(shell \
|
LIBBPF_VERSION := $(shell \
|
||||||
grep -oE '^LIBBPF_([0-9.]+)' libbpf.map | \
|
grep -oE '^LIBBPF_([0-9.]+)' $(VERSION_SCRIPT) | \
|
||||||
sort -rV | head -n1 | cut -d'_' -f2)
|
sort -rV | head -n1 | cut -d'_' -f2)
|
||||||
LIBBPF_MAJOR_VERSION := $(firstword $(subst ., ,$(LIBBPF_VERSION)))
|
LIBBPF_MAJOR_VERSION := $(firstword $(subst ., ,$(LIBBPF_VERSION)))
|
||||||
|
|
||||||
@ -131,7 +132,6 @@ SHARED_OBJDIR := $(OUTPUT)sharedobjs/
|
|||||||
STATIC_OBJDIR := $(OUTPUT)staticobjs/
|
STATIC_OBJDIR := $(OUTPUT)staticobjs/
|
||||||
BPF_IN_SHARED := $(SHARED_OBJDIR)libbpf-in.o
|
BPF_IN_SHARED := $(SHARED_OBJDIR)libbpf-in.o
|
||||||
BPF_IN_STATIC := $(STATIC_OBJDIR)libbpf-in.o
|
BPF_IN_STATIC := $(STATIC_OBJDIR)libbpf-in.o
|
||||||
VERSION_SCRIPT := libbpf.map
|
|
||||||
BPF_HELPER_DEFS := $(OUTPUT)bpf_helper_defs.h
|
BPF_HELPER_DEFS := $(OUTPUT)bpf_helper_defs.h
|
||||||
|
|
||||||
LIB_TARGET := $(addprefix $(OUTPUT),$(LIB_TARGET))
|
LIB_TARGET := $(addprefix $(OUTPUT),$(LIB_TARGET))
|
||||||
@ -184,10 +184,10 @@ $(BPF_HELPER_DEFS): $(srctree)/tools/include/uapi/linux/bpf.h
|
|||||||
|
|
||||||
$(OUTPUT)libbpf.so: $(OUTPUT)libbpf.so.$(LIBBPF_VERSION)
|
$(OUTPUT)libbpf.so: $(OUTPUT)libbpf.so.$(LIBBPF_VERSION)
|
||||||
|
|
||||||
$(OUTPUT)libbpf.so.$(LIBBPF_VERSION): $(BPF_IN_SHARED)
|
$(OUTPUT)libbpf.so.$(LIBBPF_VERSION): $(BPF_IN_SHARED) $(VERSION_SCRIPT)
|
||||||
$(QUIET_LINK)$(CC) $(LDFLAGS) \
|
$(QUIET_LINK)$(CC) $(LDFLAGS) \
|
||||||
--shared -Wl,-soname,libbpf.so.$(LIBBPF_MAJOR_VERSION) \
|
--shared -Wl,-soname,libbpf.so.$(LIBBPF_MAJOR_VERSION) \
|
||||||
-Wl,--version-script=$(VERSION_SCRIPT) $^ -lelf -lz -o $@
|
-Wl,--version-script=$(VERSION_SCRIPT) $< -lelf -lz -o $@
|
||||||
@ln -sf $(@F) $(OUTPUT)libbpf.so
|
@ln -sf $(@F) $(OUTPUT)libbpf.so
|
||||||
@ln -sf $(@F) $(OUTPUT)libbpf.so.$(LIBBPF_MAJOR_VERSION)
|
@ln -sf $(@F) $(OUTPUT)libbpf.so.$(LIBBPF_MAJOR_VERSION)
|
||||||
|
|
||||||
@ -202,7 +202,7 @@ $(OUTPUT)libbpf.pc:
|
|||||||
|
|
||||||
check: check_abi
|
check: check_abi
|
||||||
|
|
||||||
check_abi: $(OUTPUT)libbpf.so
|
check_abi: $(OUTPUT)libbpf.so $(VERSION_SCRIPT)
|
||||||
@if [ "$(GLOBAL_SYM_COUNT)" != "$(VERSIONED_SYM_COUNT)" ]; then \
|
@if [ "$(GLOBAL_SYM_COUNT)" != "$(VERSIONED_SYM_COUNT)" ]; then \
|
||||||
echo "Warning: Num of global symbols in $(BPF_IN_SHARED)" \
|
echo "Warning: Num of global symbols in $(BPF_IN_SHARED)" \
|
||||||
"($(GLOBAL_SYM_COUNT)) does NOT match with num of" \
|
"($(GLOBAL_SYM_COUNT)) does NOT match with num of" \
|
||||||
|
Loading…
Reference in New Issue
Block a user