From 8c091e4ffdb0a482c0bcd77115e67260823b6c28 Mon Sep 17 00:00:00 2001 From: Andrey Ignatov Date: Tue, 2 Apr 2019 16:33:00 -0700 Subject: [PATCH] Enable version script for DSO building Version script was synced from kernel tree but not enabled in Makefile. Enable it same way it's done in kernel tree. % readelf -s --wide src/libbpf.so | grep -Eo '[^ ]+@LIBBPF_.*' | \ cut -d@ -f 3 | sort | uniq -c 121 LIBBPF_0.0.1 29 LIBBPF_0.0.2 Signed-off-by: Andrey Ignatov --- src/Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Makefile b/src/Makefile index 64cde38..a37849f 100644 --- a/src/Makefile +++ b/src/Makefile @@ -33,6 +33,7 @@ OBJS := $(addprefix $(OBJDIR)/,bpf.o btf.o libbpf.o libbpf_errno.o netlink.o \ LIBS := $(OBJDIR)/libbpf.a ifndef BUILD_STATIC_ONLY LIBS += $(OBJDIR)/libbpf.so + VERSION_SCRIPT := libbpf.map endif HEADERS := bpf.h libbpf.h btf.h @@ -62,7 +63,8 @@ $(OBJDIR)/libbpf.a: $(OBJS) $(AR) rcs $@ $^ $(OBJDIR)/libbpf.so: $(OBJS) - $(CC) -shared $(ALL_LDFLAGS) $^ -o $@ + $(CC) -shared $(ALL_LDFLAGS) -Wl,--version-script=$(VERSION_SCRIPT) \ + $^ -o $@ $(OBJDIR)/libbpf.pc: sed -e "s|@PREFIX@|$(PREFIX)|" \