linux: pahole flags moved to scripts/Makefile.btf

pahole: added a revamped patch to remove the parallel implementation
kernel: use pahole 1.27 feature of reproducible builds
This commit is contained in:
Adrian Vladu 2024-09-10 07:42:06 +00:00
parent d8d7086805
commit 36595c9a2a
2 changed files with 72 additions and 1 deletions

View File

@ -36,7 +36,7 @@ IUSE=""
# local patches overlap with the upstream patch.
UNIPATCH_LIST="
${PATCH_DIR}/z0001-kbuild-derive-relative-path-for-srctree-from-CURDIR.patch \
${PATCH_DIR}/z0002-revert-pahole-flags.patch \
${PATCH_DIR}/z0002-pahole-support-reproducible-builds.patch \
${PATCH_DIR}/z0003-Revert-x86-boot-Remove-the-bugger-off-message.patch \
${PATCH_DIR}/z0004-efi-add-an-efi_secure_boot-flag-to-indicate-secure-b.patch \
${PATCH_DIR}/z0005-efi-lock-down-the-kernel-if-booted-in-secure-boot-mo.patch \

View File

@ -0,0 +1,71 @@
From e7593854f521ec21786fc7bfe5777b35dc627b9d Mon Sep 17 00:00:00 2001
From: Adrian Vladu <avladu@cloudbasesolutions.com>
Date: Wed, 11 Sep 2024 11:14:26 +0000
Subject: [PATCH] pahole: remove parallel -j flag
When pahole is executed with -j (parallel) then btf metadata order is
non-deterministic and the built kernel and modules don't match.
---
init/Kconfig | 2 +-
lib/Kconfig.debug | 9 ---------
scripts/Makefile.btf | 4 +---
3 files changed, 2 insertions(+), 13 deletions(-)
diff --git a/init/Kconfig b/init/Kconfig
index 9684e5d2b81c..c8544aa6856a 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -1889,7 +1889,7 @@ config RUST
depends on !GCC_PLUGINS
depends on !RANDSTRUCT
depends on !SHADOW_CALL_STACK
- depends on !DEBUG_INFO_BTF || PAHOLE_HAS_LANG_EXCLUDE
+ depends on !DEBUG_INFO_BTF
help
Enables Rust support in the kernel.
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 59b6765d86b8..611dfcce9335 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -398,15 +398,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 DEBUG_INFO_BTF_MODULES
bool "Generate BTF type information for kernel modules"
default y
diff --git a/scripts/Makefile.btf b/scripts/Makefile.btf
index 2d6e5ed9081e..291bfdab7a9b 100644
--- a/scripts/Makefile.btf
+++ b/scripts/Makefile.btf
@@ -12,8 +12,6 @@ endif
pahole-flags-$(call test-ge, $(pahole-ver), 121) += --btf_gen_floats
-pahole-flags-$(call test-ge, $(pahole-ver), 122) += -j
-
ifeq ($(pahole-ver), 125)
pahole-flags-y += --skip_encoding_btf_inconsistent_proto --btf_gen_optimized
endif
@@ -21,7 +19,7 @@ endif
else
# Switch to using --btf_features for v1.26 and later.
-pahole-flags-$(call test-ge, $(pahole-ver), 126) = -j --btf_features=encode_force,var,float,enum64,decl_tag,type_tag,optimized_func,consistent_func
+pahole-flags-$(call test-ge, $(pahole-ver), 126) = --btf_features=encode_force,var,float,enum64,decl_tag,type_tag,optimized_func,consistent_func
endif
--
2.34.1