perf build: detect support for libbpf's emit_strings option
authorBlake Jones <blakejones@google.com>
Thu, 12 Jun 2025 19:49:35 +0000 (12:49 -0700)
committerNamhyung Kim <namhyung@kernel.org>
Fri, 20 Jun 2025 21:48:14 +0000 (14:48 -0700)
commit1d0654b7fdc5431b85035f6e76b4bc57679575d8
tree20e52c0cbc88f33780a68a94bc454f2c55808e1c
parent13b38e6b8059de096ebddb5d770c2419943949b7
perf build: detect support for libbpf's emit_strings option

This creates a config option that detects libbpf's ability to display
character arrays as strings, which was just added to the BPF tree
(https://git.kernel.org/bpf/bpf-next/c/87c9c79a02b4).

To test this change, I built perf (from later in this patch set) with:

 - static libbpf (default, using source from kernel tree)
 - dynamic libbpf (LIBBPF_DYNAMIC=1 LIBBPF_INCLUDE=/usr/local/include)

For both the static and dynamic versions, I used headers with and without
the ".emit_strings" option.

I verified that of the four resulting binaries, the two with
".emit_strings" would successfully record BPF_METADATA events, and the two
without wouldn't.  All four binaries would successfully display
BPF_METADATA events, because the relevant bit of libbpf code is only used
during "perf record".

Signed-off-by: Blake Jones <blakejones@google.com>
Link: https://lore.kernel.org/r/20250612194939.162730-2-blakejones@google.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
tools/build/Makefile.feature
tools/build/feature/Makefile
tools/build/feature/test-libbpf-strings.c [new file with mode: 0644]
tools/perf/Documentation/perf-check.txt
tools/perf/Makefile.config
tools/perf/builtin-check.c