Skip to content

Commit 2bd5971

Browse files
captain5050acmel
authored andcommitted
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>
1 parent a90777b commit 2bd5971

4 files changed

Lines changed: 6 additions & 9 deletions

File tree

tools/perf/Makefile.config

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -596,13 +596,6 @@ ifndef NO_LIBELF
596596
LIBBPF_INCLUDE = $(LIBBPF_DIR)/..
597597
endif
598598
endif
599-
600-
FEATURE_CHECK_CFLAGS-libbpf-strings="-I$(LIBBPF_INCLUDE)"
601-
$(call feature_check,libbpf-strings)
602-
ifeq ($(feature-libbpf-strings), 1)
603-
$(call detected,CONFIG_LIBBPF_STRINGS)
604-
CFLAGS += -DHAVE_LIBBPF_STRINGS_SUPPORT
605-
endif
606599
endif
607600
endif # NO_LIBBPF
608601
endif # NO_LIBELF

tools/perf/builtin-check.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// SPDX-License-Identifier: GPL-2.0
22
#include "builtin.h"
33
#include "color.h"
4+
#include "util/bpf-utils.h"
45
#include "util/debug.h"
56
#include "util/header.h"
67
#include <tools/config.h>

tools/perf/util/bpf-event.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,9 +288,7 @@ static void format_btf_variable(struct btf *btf, char *buf, size_t buf_size,
288288
.sz = sizeof(struct btf_dump_type_data_opts),
289289
.skip_names = 1,
290290
.compact = 1,
291-
#if LIBBPF_CURRENT_VERSION_GEQ(1, 7)
292291
.emit_strings = 1,
293-
#endif
294292
};
295293
struct btf_dump *d;
296294
size_t btf_size;

tools/perf/util/bpf-utils.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@
1414
(LIBBPF_MAJOR_VERSION > (major) || \
1515
(LIBBPF_MAJOR_VERSION == (major) && LIBBPF_MINOR_VERSION >= (minor)))
1616

17+
#if LIBBPF_CURRENT_VERSION_GEQ(1, 7)
18+
// libbpf 1.7+ support the btf_dump_type_data_opts.emit_strings option.
19+
#define HAVE_LIBBPF_STRINGS_SUPPORT 1
20+
#endif
21+
1722
/*
1823
* Get bpf_prog_info in continuous memory
1924
*

0 commit comments

Comments
 (0)