perf tools: Enable libtracefs dynamic linking

Currently libtracefs isn't used by perf, but there are potential
improvements by using it as identified Steven Rostedt's e-mail:
https://lore.kernel.org/lkml/20210610154759.1ef958f0@oasis.local.home/

This change is modelled on the dynamic libtraceevent patch by Michael
Petlan:

https://lore.kernel.org/linux-perf-users/20210428092023.4009-1-mpetlan@redhat.com/

v3. Adds file missed in v1 and v2 spotted by Jiri Olsa.

Signed-off-by: Ian Rogers <irogers@google.com>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
Cc: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
Cc: linux-trace-devel@vger.kernel.org
Link: http://lore.kernel.org/lkml/20210923001024.550263-1-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Ian Rogers 2021-09-22 17:10:21 -07:00 committed by Arnaldo Carvalho de Melo
parent 3d5ac9effc
commit b758a61b39
5 changed files with 26 additions and 0 deletions

View File

@ -52,6 +52,7 @@ FEATURE_TESTS_BASIC := \
libslang \
libslang-include-subdir \
libtraceevent \
libtracefs \
libcrypto \
libunwind \
pthread-attr-setaffinity-np \

View File

@ -36,6 +36,7 @@ FILES= \
test-libslang.bin \
test-libslang-include-subdir.bin \
test-libtraceevent.bin \
test-libtracefs.bin \
test-libcrypto.bin \
test-libunwind.bin \
test-libunwind-debug-frame.bin \
@ -199,6 +200,9 @@ $(OUTPUT)test-libslang-include-subdir.bin:
$(OUTPUT)test-libtraceevent.bin:
$(BUILD) -ltraceevent
$(OUTPUT)test-libtracefs.bin:
$(BUILD) -ltracefs
$(OUTPUT)test-libcrypto.bin:
$(BUILD) -lcrypto

View File

@ -0,0 +1,10 @@
// SPDX-License-Identifier: GPL-2.0
#include <tracefs/tracefs.h>
int main(void)
{
struct tracefs_instance *inst = tracefs_instance_create("dummy");
tracefs_instance_destroy(inst);
return 0;
}

View File

@ -1098,6 +1098,15 @@ ifdef LIBTRACEEVENT_DYNAMIC
endif
endif
ifdef LIBTRACEFS_DYNAMIC
$(call feature_check,libtracefs)
ifeq ($(feature-libtracefs), 1)
EXTLIBS += -ltracefs
else
dummy := $(error Error: No libtracefs devel library found, please install libtracefs-dev);
endif
endif
# Among the variables below, these:
# perfexecdir
# perf_include_dir

View File

@ -130,6 +130,8 @@ include ../scripts/utilities.mak
#
# Define LIBTRACEEVENT_DYNAMIC to enable libtraceevent dynamic linking
#
# Define LIBTRACEFS_DYNAMIC to enable libtracefs dynamic linking
#
# As per kernel Makefile, avoid funny character set dependencies
unexport LC_ALL