]> www.infradead.org Git - users/hch/misc.git/commitdiff
perf bpf-event: Use libbpf version rather than feature check
authorIan Rogers <irogers@google.com>
Fri, 3 Oct 2025 01:23:48 +0000 (18:23 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Fri, 3 Oct 2025 19:49:51 +0000 (16:49 -0300)
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>
tools/perf/Makefile.config
tools/perf/builtin-check.c
tools/perf/util/bpf-event.c
tools/perf/util/bpf-utils.h

index 6dc5b2811ae1cdbc47ba6eb57ae6ac3731aea1e6..0f09f30f1906b7a8ec16fe7a970771038b407a4d 100644 (file)
@@ -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
index 7fd054760e47847b7e2c8966790d2febc7ee3e1a..8c0668911fb19fa24ab05f3890671a6deeacfa9e 100644 (file)
@@ -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>
index 59f84aef91b4a2ece4d63e1572d138936c11c91e..2298cd396c4235e253c85fe4f6089197b971215b 100644 (file)
@@ -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;
index eafc43b8731f1e31f7d0a6b05165acbe24f34f49..a8bc1a2329684191f237f685c3c3f3009b9343fa 100644 (file)
        (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
  *