Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

kbuild: Add CONFIG_PAHOLE_VERSION

There are a few different places where pahole's version is turned into a
three digit form with the exact same command. Move this command into
scripts/pahole-version.sh to reduce the amount of duplication across the
tree.

Create CONFIG_PAHOLE_VERSION so the version code can be used in Kconfig
to enable and disable configuration options based on the pahole version,
which is already done in a couple of places.

Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20220201205624.652313-3-nathan@kernel.org

authored by

Nathan Chancellor and committed by
Daniel Borkmann
613fe169 f67644b4

+18
+1
MAINTAINERS
··· 3524 3524 F: samples/bpf/ 3525 3525 F: scripts/bpf_doc.py 3526 3526 F: scripts/pahole-flags.sh 3527 + F: scripts/pahole-version.sh 3527 3528 F: tools/bpf/ 3528 3529 F: tools/lib/bpf/ 3529 3530 F: tools/testing/selftests/bpf/
+4
init/Kconfig
··· 86 86 config CC_HAS_NO_PROFILE_FN_ATTR 87 87 def_bool $(success,echo '__attribute__((no_profile_instrument_function)) int x();' | $(CC) -x c - -c -o /dev/null -Werror) 88 88 89 + config PAHOLE_VERSION 90 + int 91 + default $(shell,$(srctree)/scripts/pahole-version.sh $(PAHOLE)) 92 + 89 93 config CONSTRUCTORS 90 94 bool 91 95
+13
scripts/pahole-version.sh
··· 1 + #!/bin/sh 2 + # SPDX-License-Identifier: GPL-2.0 3 + # 4 + # Usage: $ ./pahole-version.sh pahole 5 + # 6 + # Prints pahole's version in a 3-digit form, such as 119 for v1.19. 7 + 8 + if [ ! -x "$(command -v "$@")" ]; then 9 + echo 0 10 + exit 1 11 + fi 12 + 13 + "$@" --version | sed -E 's/v([0-9]+)\.([0-9]+)/\1\2/'