Commit 613fe169 authored by Nathan Chancellor's avatar Nathan Chancellor Committed by Daniel Borkmann
Browse files

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: default avatarNathan Chancellor <nathan@kernel.org>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
Acked-by: default avatarAndrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20220201205624.652313-3-nathan@kernel.org
parent f67644b4
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -3524,6 +3524,7 @@ F: net/sched/cls_bpf.c
F:	samples/bpf/
F:	scripts/bpf_doc.py
F:	scripts/pahole-flags.sh
F:	scripts/pahole-version.sh
F:	tools/bpf/
F:	tools/lib/bpf/
F:	tools/testing/selftests/bpf/
+4 −0
Original line number Diff line number Diff line
@@ -86,6 +86,10 @@ config CC_HAS_ASM_INLINE
config CC_HAS_NO_PROFILE_FN_ATTR
	def_bool $(success,echo '__attribute__((no_profile_instrument_function)) int x();' | $(CC) -x c - -c -o /dev/null -Werror)

config PAHOLE_VERSION
	int
	default $(shell,$(srctree)/scripts/pahole-version.sh $(PAHOLE))

config CONSTRUCTORS
	bool

+13 −0
Original line number Diff line number Diff line
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
#
# Usage: $ ./pahole-version.sh pahole
#
# Prints pahole's version in a 3-digit form, such as 119 for v1.19.

if [ ! -x "$(command -v "$@")" ]; then
	echo 0
	exit 1
fi

"$@" --version | sed -E 's/v([0-9]+)\.([0-9]+)/\1\2/'