[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAP-5=fXQSA2PWCWQh7d7ou77pLvk9QcicnJc303+C_vHr2Tb2w@mail.gmail.com>
Date: Fri, 19 Sep 2025 15:03:19 -0700
From: Ian Rogers <irogers@...gle.com>
To: Arnaldo Carvalho de Melo <acme@...nel.org>
Cc: Namhyung Kim <namhyung@...nel.org>, Ingo Molnar <mingo@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>, James Clark <james.clark@...aro.org>,
Jiri Olsa <jolsa@...nel.org>, Adrian Hunter <adrian.hunter@...el.com>,
Kan Liang <kan.liang@...ux.intel.com>, Clark Williams <williams@...hat.com>,
linux-kernel@...r.kernel.org, linux-perf-users@...r.kernel.org,
Arnaldo Carvalho de Melo <acme@...hat.com>, Andrii Nakryiko <andrii@...nel.org>
Subject: Re: [PATCH 2/2] perf bpf: Check libbpf version to use btf_dump_type_data_opts.emit_strings
On Fri, Sep 19, 2025 at 2:07 PM Arnaldo Carvalho de Melo
<acme@...nel.org> wrote:
>
> From: Arnaldo Carvalho de Melo <acme@...hat.com>
>
> When building perf with LIBBPF_DINAMIC=1 on a fedora system with
nit: s/DINAMIC/DYNAMIC/
> 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.
>
> Cc: Adrian Hunter <adrian.hunter@...el.com>
> Cc: Andrii Nakryiko <andrii@...nel.org>
> Cc: Ian Rogers <irogers@...gle.com>
> Cc: James Clark <james.clark@...aro.org>
> Cc: Jiri Olsa <jolsa@...nel.org>
> Cc: Kan Liang <kan.liang@...ux.intel.com>
> Cc: Namhyung Kim <namhyung@...nel.org>
> Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
Reviewed-by: Ian Rogers <irogers@...gle.com>
Thanks,
Ian
> ---
> tools/perf/util/bpf-event.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/tools/perf/util/bpf-event.c b/tools/perf/util/bpf-event.c
> index 2298cd396c4235e2..59f84aef91b4a2ec 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;
> --
> 2.51.0
>
Powered by blists - more mailing lists