linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Namhyung Kim <namhyung@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	James Clark <james.clark@linaro.org>,
	Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Kan Liang <kan.liang@linux.intel.com>,
	Clark Williams <williams@redhat.com>,
	linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	Andrii Nakryiko <andrii@kernel.org>
Subject: [PATCH 2/2] perf bpf: Check libbpf version to use btf_dump_type_data_opts.emit_strings
Date: Fri, 19 Sep 2025 18:06:54 -0300	[thread overview]
Message-ID: <20250919210654.317656-3-acme@kernel.org> (raw)
In-Reply-To: <20250919210654.317656-1-acme@kernel.org>

From: Arnaldo Carvalho de Melo <acme@redhat.com>

When building perf with LIBBPF_DINAMIC=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.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andrii Nakryiko <andrii@kernel.org>
Cc: Ian Rogers <irogers@google.com>
Cc: James Clark <james.clark@linaro.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 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


  parent reply	other threads:[~2025-09-19 21:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-19 21:06 [PATCH 0/2] LIBBPF_DYNAMIC=1 fixes Arnaldo Carvalho de Melo
2025-09-19 21:06 ` [PATCH 1/2] perf bpf: Move the LIBBPF_CURRENT_VERSION_GEQ macro to bpf-utils.h Arnaldo Carvalho de Melo
2025-09-19 22:04   ` Ian Rogers
2025-09-19 21:06 ` Arnaldo Carvalho de Melo [this message]
2025-09-19 22:03   ` [PATCH 2/2] perf bpf: Check libbpf version to use btf_dump_type_data_opts.emit_strings Ian Rogers
2025-09-19 21:58 ` [PATCH 0/2] LIBBPF_DYNAMIC=1 fixes Namhyung Kim
2025-09-19 22:10   ` Ian Rogers
2025-09-30 20:10     ` Ian Rogers
2025-10-01 13:34       ` Arnaldo Carvalho de Melo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250919210654.317656-3-acme@kernel.org \
    --to=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=adrian.hunter@intel.com \
    --cc=andrii@kernel.org \
    --cc=irogers@google.com \
    --cc=james.clark@linaro.org \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=williams@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).