Skip to contentSkip to conversation

Set the minimum required pahole version to v1.24

PATCH New Yonghong Song 1 participant 3 messages Nov 24

Subsystems (5)
lore
Share & tools
lore

Yonghong Song

author reviewer
#0 lore raw

v2 cover Set the minimum required pahole version to v1.24

The requirements table in Documentation/process/changes.rst lists pahole v1.26 as the minimal version, for kfuncs with KF_IMPLICIT_ARGS, which resolve_btfids now handles without pahole. CONFIG_DEBUG_INFO_BTF, on the other hand, still accepts pahole v1.22.

Patch 1 sets the minimal version to v1.24 in Kconfig and changes.rst, so that the kflag of an enum in vmlinux and module BTF is meaningful: 0 for an unsigned enum and 1 for a signed enum. Patch 2 removes CONFIG_PAHOLE_HAS_LANG_EXCLUDE, which is always set with CONFIG_DEBUG_INFO_BTF now.

Changelog:
v1 -> v2:
- v1: https://lore.kernel.org/bpf/[email protected]/
- Keep CONFIG_PAHOLE_HAS_BTF_TAG unchanged, since its pahole version check still matters without CONFIG_DEBUG_INFO_BTF, so that the resulting config stays the same (patch 2).

Yonghong Song (2):
lib/Kconfig.debug: Set the minimum required pahole version to v1.24 kbuild, bpf: Remove CONFIG_PAHOLE_HAS_LANG_EXCLUDE

 Documentation/process/changes.rst |  4 ++--
 init/Kconfig                      |  2 +-
 lib/Kconfig.debug                 | 13 ++-----------
 scripts/Makefile.btf              |  2 +-
 4 files changed, 6 insertions(+), 15 deletions(-)
Signature · 1 line
2.53.1-Meta
author reviewer
#1 lore raw

PATCH v2 1/2 lib/Kconfig.debug: Set the minimum required pahole version to v1.24

Commit 2c1ccd9a1d78 ("docs: changes.rst: restore pahole 1.26 minimum (regressed by sort)") raised the minimal pahole version in the requirements table of Documentation/process/changes.rst to v1.26, since kfuncs with KF_IMPLICIT_ARGS needed the decl_tag_kfuncs feature of pahole v1.26. Commit 692393104909 ("resolve_btfids: Emit bpf_kfunc and bpf_fastcall decl tags") removed that need, as resolve_btfids now emits the kfunc decl tags itself. CONFIG_DEBUG_INFO_BTF, on the other hand, still accepts pahole v1.22.

Set the minimal version to v1.24, so that the kflag of an enum in vmlinux and module BTF is meaningful: 0 for an unsigned enum and 1 for a signed enum. pahole records the signedness of an enum in the kflag since v1.24. With an older pahole, every enum has the kflag 0, signed or not.

---
 Documentation/process/changes.rst | 4 ++--
 lib/Kconfig.debug                 | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
Documentation/process/changes.rst +2 -2
index 28f2ca63318e..a292f31f1891 100644
@@ -53,7 +53,7 @@ mcelog                 0.6              mcelog --version
 mkimage (optional)     2017.01          mkimage --version
 nfs-utils              1.0.5            showmount --version
 openssl & libcrypto    1.0.0            openssl version
-pahole                 1.26             pahole --version
+pahole                 1.24             pahole --version
 pcmciautils            004              pccardctl -V
 pigz (optional)        2.4              pigz --version
 PPP                    2.4.0            pppd --version
@@ -146,7 +146,7 @@ pahole
 
 Since Linux 5.2, if CONFIG_DEBUG_INFO_BTF is selected, the build system
 generates BTF (BPF Type Format) from DWARF in vmlinux, a bit later from kernel
-modules as well.  This requires pahole v1.22 or later.
+modules as well.  This requires pahole v1.24 or later.
 
 It is found in the 'dwarves' or 'pahole' distro packages or from
 https://fedorapeople.org/~acme/dwarves/.
lib/Kconfig.debug +2 -2
index 2d22638ec13a..9479034afe5a 100644
@@ -400,12 +400,12 @@ config DEBUG_INFO_BTF
 	depends on !DEBUG_INFO_SPLIT && !DEBUG_INFO_REDUCED
 	depends on !GCC_PLUGIN_RANDSTRUCT || COMPILE_TEST
 	depends on BPF_SYSCALL
-	depends on PAHOLE_VERSION >= 122
+	depends on PAHOLE_VERSION >= 124
 	# pahole uses elfutils, which does not have support for Hexagon relocations
 	depends on !HEXAGON
 	help
 	  Generate deduplicated BTF type information from DWARF debug info.
-	  Turning this on requires pahole v1.22 or later, which will convert
+	  Turning this on requires pahole v1.24 or later, which will convert
 	  DWARF type info into equivalent deduplicated BTF type info.
 
 config PAHOLE_HAS_BTF_TAG
Signature · 1 line
2.53.1-Meta
author reviewer
#2 lore raw

PATCH v2 2/2 kbuild, bpf: Remove CONFIG_PAHOLE_HAS_LANG_EXCLUDE

In reply to Yonghong Song

The previous patch makes CONFIG_DEBUG_INFO_BTF require pahole v1.24, so CONFIG_PAHOLE_HAS_LANG_EXCLUDE (pahole v1.24) is always set with CONFIG_DEBUG_INFO_BTF.

Remove it. CONFIG_RUST now depends on !CONFIG_DEBUG_INFO_BTF || !CONFIG_LTO, and scripts/Makefile.btf, which is only included with CONFIG_DEBUG_INFO_BTF, always passes --lang_exclude=rust.

The pahole flags and the resulting config are unchanged, except that CONFIG_PAHOLE_HAS_LANG_EXCLUDE is gone.

---
 init/Kconfig         | 2 +-
 lib/Kconfig.debug    | 9 ---------
 scripts/Makefile.btf | 2 +-
 3 files changed, 2 insertions(+), 11 deletions(-)
init/Kconfig +1 -1
index c8a7cfa60a6e..ca7f20462d0c 100644
@@ -2065,7 +2065,7 @@ config RUST
 	depends on !MODVERSIONS || GENDWARFKSYMS
 	depends on !GCC_PLUGIN_RANDSTRUCT
 	depends on !RANDSTRUCT
-	depends on !DEBUG_INFO_BTF || (PAHOLE_HAS_LANG_EXCLUDE && !LTO)
+	depends on !DEBUG_INFO_BTF || !LTO
 	depends on !CFI || HAVE_CFI_ICALL_NORMALIZE_INTEGERS_RUSTC
 	select CFI_ICALL_NORMALIZE_INTEGERS if CFI
 	depends on !KASAN || CC_IS_CLANG
lib/Kconfig.debug +0 -9
index 9479034afe5a..1d35a99d6cb5 100644
@@ -416,15 +416,6 @@ config PAHOLE_HAS_BTF_TAG
 	  btf_decl_tag) or not. Currently only clang compiler implements
 	  these attributes, so make the config depend on CC_IS_CLANG.
 
-config PAHOLE_HAS_LANG_EXCLUDE
-	def_bool PAHOLE_VERSION >= 124
-	help
-	  Support for the --lang_exclude flag which makes pahole exclude
-	  compilation units from the supplied language. Used in Kbuild to
-	  omit Rust CUs which are not supported in version 1.24 of pahole,
-	  otherwise it would emit malformed kernel and module binaries when
-	  using DEBUG_INFO_BTF_MODULES.
-
 config PAHOLE_HAS_INLINE
 	def_bool PAHOLE_VERSION >= 132
 	help
scripts/Makefile.btf +1 -1
index 02ff1702e1e8..8cd8c88d4580 100644
@@ -20,7 +20,7 @@ pahole-flags-$(call test-ge, $(pahole-ver), 131) += --btf_features=layout
 
 endif
 
-pahole-flags-$(CONFIG_PAHOLE_HAS_LANG_EXCLUDE)		+= --lang_exclude=rust
+pahole-flags-y						+= --lang_exclude=rust
 
 btf-inline := $(CONFIG_DEBUG_INFO_BTF_INLINE)
 ifneq ($(btf-inline),)
Signature · 1 line
2.53.1-Meta