diff options
| author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2025-09-19 18:02:23 -0300 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2025-09-30 13:36:08 -0300 |
| commit | aacaf65bb11598669f8bfff413c63eaf7bcbb6f1 (patch) | |
| tree | 670d641845f4e0cd872634767e8309b548cda513 /tools | |
| parent | perf bpf: Move the LIBBPF_CURRENT_VERSION_GEQ macro to bpf-utils.h (diff) | |
| download | linux-aacaf65bb11598669f8bfff413c63eaf7bcbb6f1.tar.gz linux-aacaf65bb11598669f8bfff413c63eaf7bcbb6f1.zip | |
perf bpf: Check libbpf version to use btf_dump_type_data_opts.emit_strings
When building perf with LIBBPF_DYNAMIC=1 on a fedora system with
libbpf-devel 1.5 I it was breaking with:
util/bpf-event.c: In function ‘format_btf_variable’:
util/bpf-event.c:291:18: error: ‘const struct btf_dump_type_data_opts’ has no member named ‘emit_strings’
291 | .emit_strings = 1,
| ^~~~~~~~~~~~
util/bpf-event.c:291:33: error: initialized field overwritten [-Werror=override-init]
291 | .emit_strings = 1,
| ^
util/bpf-event.c:291:33: note: (near initialization for ‘opts.skip_names’)
Check the version before using that feature.
Reviewed-by: Ian Rogers <irogers@google.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andrii Nakryiko <andrii@kernel.org>
Cc: James Clark <james.clark@linaro.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/perf/util/bpf-event.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/perf/util/bpf-event.c b/tools/perf/util/bpf-event.c index 2298cd396c42..59f84aef91b4 100644 --- a/tools/perf/util/bpf-event.c +++ b/tools/perf/util/bpf-event.c @@ -288,7 +288,9 @@ 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; |
