perf tools: Enable libtraceevent dynamic linking
Currently we support only static linking with kernel's libtraceevent (tools/lib/traceevent). This patch adds libtraceevent package detection and support to link perf with it dynamically. The libtraceevent package status is displayed with: $ make VF=1 LIBTRACEEVENT_DYNAMIC=1 ... ... libtraceevent: [ on ] Default behavior remains the same (static linking). Committer testing: $ make LIBTRACEEVENT_DYNAMIC=1 VF=1 O=/tmp/build/perf -C tools/perf install-bin |& grep traceevent Makefile.config:1090: *** Error: No libtraceevent devel library found, please install libtraceevent-devel. Stop. $ Signed-off-by: Michael Petlan <mpetlan@redhat.com> Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Jiri Olsa <jolsa@redhat.com> LPU-Reference: 20210428092023.4009-1-mpetlan@redhat.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
2750ce1d4d
commit
56d32d4cac
@ -52,6 +52,7 @@ FEATURE_TESTS_BASIC := \
|
|||||||
libpython-version \
|
libpython-version \
|
||||||
libslang \
|
libslang \
|
||||||
libslang-include-subdir \
|
libslang-include-subdir \
|
||||||
|
libtraceevent \
|
||||||
libcrypto \
|
libcrypto \
|
||||||
libunwind \
|
libunwind \
|
||||||
pthread-attr-setaffinity-np \
|
pthread-attr-setaffinity-np \
|
||||||
|
@ -36,6 +36,7 @@ FILES= \
|
|||||||
test-libpython-version.bin \
|
test-libpython-version.bin \
|
||||||
test-libslang.bin \
|
test-libslang.bin \
|
||||||
test-libslang-include-subdir.bin \
|
test-libslang-include-subdir.bin \
|
||||||
|
test-libtraceevent.bin \
|
||||||
test-libcrypto.bin \
|
test-libcrypto.bin \
|
||||||
test-libunwind.bin \
|
test-libunwind.bin \
|
||||||
test-libunwind-debug-frame.bin \
|
test-libunwind-debug-frame.bin \
|
||||||
@ -196,6 +197,9 @@ $(OUTPUT)test-libslang.bin:
|
|||||||
$(OUTPUT)test-libslang-include-subdir.bin:
|
$(OUTPUT)test-libslang-include-subdir.bin:
|
||||||
$(BUILD) -lslang
|
$(BUILD) -lslang
|
||||||
|
|
||||||
|
$(OUTPUT)test-libtraceevent.bin:
|
||||||
|
$(BUILD) -ltraceevent
|
||||||
|
|
||||||
$(OUTPUT)test-libcrypto.bin:
|
$(OUTPUT)test-libcrypto.bin:
|
||||||
$(BUILD) -lcrypto
|
$(BUILD) -lcrypto
|
||||||
|
|
||||||
|
12
tools/build/feature/test-libtraceevent.c
Normal file
12
tools/build/feature/test-libtraceevent.c
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-2.0
|
||||||
|
#include <traceevent/trace-seq.h>
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
int rv = 0;
|
||||||
|
struct trace_seq s;
|
||||||
|
trace_seq_init(&s);
|
||||||
|
rv += !(s.state == TRACE_SEQ__GOOD);
|
||||||
|
trace_seq_destroy(&s);
|
||||||
|
return rv;
|
||||||
|
}
|
@ -1079,6 +1079,15 @@ ifdef LIBPFM4
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifdef LIBTRACEEVENT_DYNAMIC
|
||||||
|
$(call feature_check,libtraceevent)
|
||||||
|
ifeq ($(feature-libtraceevent), 1)
|
||||||
|
EXTLIBS += -ltraceevent
|
||||||
|
else
|
||||||
|
dummy := $(error Error: No libtraceevent devel library found, please install libtraceevent-devel);
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
# Among the variables below, these:
|
# Among the variables below, these:
|
||||||
# perfexecdir
|
# perfexecdir
|
||||||
# perf_include_dir
|
# perf_include_dir
|
||||||
|
@ -128,6 +128,8 @@ include ../scripts/utilities.mak
|
|||||||
#
|
#
|
||||||
# Define BUILD_BPF_SKEL to enable BPF skeletons
|
# Define BUILD_BPF_SKEL to enable BPF skeletons
|
||||||
#
|
#
|
||||||
|
# Define LIBTRACEEVENT_DYNAMIC to enable libtraceevent dynamic linking
|
||||||
|
#
|
||||||
|
|
||||||
# As per kernel Makefile, avoid funny character set dependencies
|
# As per kernel Makefile, avoid funny character set dependencies
|
||||||
unexport LC_ALL
|
unexport LC_ALL
|
||||||
@ -310,7 +312,6 @@ endif
|
|||||||
|
|
||||||
LIBTRACEEVENT = $(TE_PATH)libtraceevent.a
|
LIBTRACEEVENT = $(TE_PATH)libtraceevent.a
|
||||||
export LIBTRACEEVENT
|
export LIBTRACEEVENT
|
||||||
|
|
||||||
LIBTRACEEVENT_DYNAMIC_LIST = $(PLUGINS_PATH)libtraceevent-dynamic-list
|
LIBTRACEEVENT_DYNAMIC_LIST = $(PLUGINS_PATH)libtraceevent-dynamic-list
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -375,12 +376,15 @@ endif
|
|||||||
|
|
||||||
export PERL_PATH
|
export PERL_PATH
|
||||||
|
|
||||||
PERFLIBS = $(LIBAPI) $(LIBTRACEEVENT) $(LIBSUBCMD) $(LIBPERF)
|
PERFLIBS = $(LIBAPI) $(LIBSUBCMD) $(LIBPERF)
|
||||||
ifndef NO_LIBBPF
|
ifndef NO_LIBBPF
|
||||||
ifndef LIBBPF_DYNAMIC
|
ifndef LIBBPF_DYNAMIC
|
||||||
PERFLIBS += $(LIBBPF)
|
PERFLIBS += $(LIBBPF)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
ifndef LIBTRACEEVENT_DYNAMIC
|
||||||
|
PERFLIBS += $(LIBTRACEEVENT)
|
||||||
|
endif
|
||||||
|
|
||||||
# We choose to avoid "if .. else if .. else .. endif endif"
|
# We choose to avoid "if .. else if .. else .. endif endif"
|
||||||
# because maintaining the nesting to match is a pain. If
|
# because maintaining the nesting to match is a pain. If
|
||||||
|
Loading…
Reference in New Issue
Block a user