summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2025-10-02 18:23:48 -0700
committerArnaldo Carvalho de Melo <acme@redhat.com>2025-10-03 16:49:51 -0300
commit2bd597170f46610792c541814ac36d14618de459 (patch)
tree041295dfcb96718090b76b3fc3b0d2ec723d2425
parenta90777bb03fc7b9bc5d668ed136d86c3971f48bf (diff)
perf bpf-event: Use libbpf version rather than feature check
The feature check guarded the -DHAVE_LIBBPF_STRINGS_SUPPORT is unnecessary as it is sufficient and easier to use the LIBBPF_CURRENT_VERSION_GEQ macro. Signed-off-by: Ian Rogers <irogers@google.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Blake Jones <blakejones@google.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r--tools/perf/Makefile.config7
-rw-r--r--tools/perf/builtin-check.c1
-rw-r--r--tools/perf/util/bpf-event.c2
-rw-r--r--tools/perf/util/bpf-utils.h5
4 files changed, 6 insertions, 9 deletions
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index 6dc5b2811ae1..0f09f30f1906 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -596,13 +596,6 @@ ifndef NO_LIBELF
LIBBPF_INCLUDE = $(LIBBPF_DIR)/..
endif
endif
-
- FEATURE_CHECK_CFLAGS-libbpf-strings="-I$(LIBBPF_INCLUDE)"
- $(call feature_check,libbpf-strings)
- ifeq ($(feature-libbpf-strings), 1)
- $(call detected,CONFIG_LIBBPF_STRINGS)
- CFLAGS += -DHAVE_LIBBPF_STRINGS_SUPPORT
- endif
endif
endif # NO_LIBBPF
endif # NO_LIBELF
diff --git a/tools/perf/builtin-check.c b/tools/perf/builtin-check.c
index 7fd054760e47..8c0668911fb1 100644
--- a/tools/perf/builtin-check.c
+++ b/tools/perf/builtin-check.c
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
#include "builtin.h"
#include "color.h"
+#include "util/bpf-utils.h"
#include "util/debug.h"
#include "util/header.h"
#include <tools/config.h>
diff --git a/tools/perf/util/bpf-event.c b/tools/perf/util/bpf-event.c
index 59f84aef91b4..2298cd396c42 100644
--- a/tools/perf/util/bpf-event.c
+++ b/tools/perf/util/bpf-event.c
@@ -288,9 +288,7 @@ static void format_btf_variable(struct btf *btf, char *buf, size_t buf_size,
.sz = sizeof(struct btf_dump_type_data_opts),
.skip_names = 1,
.compact = 1,
-#if LIBBPF_CURRENT_VERSION_GEQ(1, 7)
.emit_strings = 1,
-#endif
};
struct btf_dump *d;
size_t btf_size;
diff --git a/tools/perf/util/bpf-utils.h b/tools/perf/util/bpf-utils.h
index eafc43b8731f..a8bc1a232968 100644
--- a/tools/perf/util/bpf-utils.h
+++ b/tools/perf/util/bpf-utils.h
@@ -14,6 +14,11 @@
(LIBBPF_MAJOR_VERSION > (major) || \
(LIBBPF_MAJOR_VERSION == (major) && LIBBPF_MINOR_VERSION >= (minor)))
+#if LIBBPF_CURRENT_VERSION_GEQ(1, 7)
+// libbpf 1.7+ support the btf_dump_type_data_opts.emit_strings option.
+#define HAVE_LIBBPF_STRINGS_SUPPORT 1
+#endif
+
/*
* Get bpf_prog_info in continuous memory
*