File libperf-add-build-version-support.patch of Package perf
112
1
From: Jiri Olsa <jolsa@kernel.org>
2
Date: Sun, 21 Jul 2019 13:24:11 +0200
3
Subject: libperf: Add build version support
4
Git-commit: 47f9bccc79cb067103ad5e9790e0d01c94839429
5
Patch-mainline: v5.4-rc1
6
References: jsc#SLE-13661
7
8
Add a shared library version, generating the following files:
9
10
$ ll tools/perf/lib/libperf.so*
11
libperf.so -> libperf.so.0.0.1
12
libperf.so.0 -> libperf.so.0.0.1
13
libperf.so.0.0.1
14
15
Committer testing:
16
17
One has to build just libbperf to get this, building perf so far doesn't
18
trigger this, i.e. I tried:
19
20
$ make O=/tmp/build/perf -C tools/perf
21
22
And the files above were not created, so one has to do:
23
24
$ make O=/tmp/build/perf -C tools/perf/lib/
25
make: Entering directory '/home/acme/git/perf/tools/perf/lib'
26
LINK /tmp/build/perf/libperf.so.0.0.1
27
make: Leaving directory '/home/acme/git/perf/tools/perf/lib'
28
$ ls -la /tmp/build/perf/*.so.*
29
lrwxrwxrwx. 1 acme acme 16 Jul 22 15:37 /tmp/build/perf/libperf.so.0 -> libperf.so.0.0.1
30
-rwxrwxr-x. 1 acme acme 16368 Jul 22 15:37 /tmp/build/perf/libperf.so.0.0.1
31
$
32
33
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
34
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
35
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
36
Cc: Alexey Budankov <alexey.budankov@linux.intel.com>
37
Cc: Andi Kleen <ak@linux.intel.com>
38
Cc: Michael Petlan <mpetlan@redhat.com>
39
Cc: Namhyung Kim <namhyung@kernel.org>
40
Cc: Peter Zijlstra <peterz@infradead.org>
41
Link: http://lkml.kernel.org/r/20190721112506.12306-25-jolsa@kernel.org
42
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
43
Signed-off-by: Tony Jones <tonyj@suse.de>
44
---
45
tools/perf/lib/Makefile | 20 +++++++++++++++++---
46
tools/perf/lib/libperf.map | 4 ++++
47
2 files changed, 21 insertions(+), 3 deletions(-)
48
49
diff --git a/tools/perf/lib/Makefile b/tools/perf/lib/Makefile
50
index 33046e7c6a2a..cd571ec648ad 100644
51
--- a/tools/perf/lib/Makefile
52
+++ b/tools/perf/lib/Makefile
53
54
# SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause)
55
# Most of this file is copied from tools/lib/bpf/Makefile
56
57
+LIBPERF_VERSION = 0
58
+LIBPERF_PATCHLEVEL = 0
59
+LIBPERF_EXTRAVERSION = 1
60
+
61
MAKEFLAGS += --no-print-directory
62
63
ifeq ($(srctree),)
64
65
export srctree OUTPUT CC LD CFLAGS V
66
include $(srctree)/tools/build/Makefile.include
67
68
-LIBPERF_SO := $(OUTPUT)libperf.so
69
+VERSION_SCRIPT := libperf.map
70
+
71
+PATCHLEVEL = $(LIBPERF_PATCHLEVEL)
72
+EXTRAVERSION = $(LIBPERF_EXTRAVERSION)
73
+VERSION = $(LIBPERF_VERSION).$(LIBPERF_PATCHLEVEL).$(LIBPERF_EXTRAVERSION)
74
+
75
+LIBPERF_SO := $(OUTPUT)libperf.so.$(VERSION)
76
LIBPERF_A := $(OUTPUT)libperf.a
77
LIBPERF_IN := $(OUTPUT)libperf-in.o
78
79
80
$(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(LIBPERF_IN)
81
82
$(LIBPERF_SO): $(LIBPERF_IN)
83
- $(QUIET_LINK)$(CC) --shared -Wl,-soname,libperf.so $^ -o $@
84
+ $(QUIET_LINK)$(CC) --shared -Wl,-soname,libperf.so \
85
+ -Wl,--version-script=$(VERSION_SCRIPT) $^ -o $@
86
+ @ln -sf $(@F) $(OUTPUT)libperf.so
87
+ @ln -sf $(@F) $(OUTPUT)libperf.so.$(LIBPERF_VERSION)
88
+
89
90
libs: $(LIBPERF_A) $(LIBPERF_SO)
91
92
93
94
clean:
95
$(call QUIET_CLEAN, libperf) $(RM) $(LIBPERF_A) \
96
- *.o *~ *.a *.so .*.d .*.cmd LIBPERF-CFLAGS
97
+ *.o *~ *.a *.so *.so.$(VERSION) *.so.$(LIBPERF_VERSION) .*.d .*.cmd LIBPERF-CFLAGS
98
99
FORCE:
100
101
diff --git a/tools/perf/lib/libperf.map b/tools/perf/lib/libperf.map
102
new file mode 100644
103
index 000000000000..a8e913988edf
104
--- /dev/null
105
+++ b/tools/perf/lib/libperf.map
106
107
+LIBPERF_0.0.1 {
108
+ local:
109
+ *;
110
+};
111
112