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 38cd59cab3
commit 1fa0474efa
3 changed files with 27 additions and 54 deletions

View File

@ -36,7 +36,7 @@ IUSE=""
# local patches overlap with the upstream patch. # local patches overlap with the upstream patch.
UNIPATCH_LIST=" UNIPATCH_LIST="
${PATCH_DIR}/z0001-kbuild-derive-relative-path-for-srctree-from-CURDIR.patch \ ${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}/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}/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 \ ${PATCH_DIR}/z0005-efi-lock-down-the-kernel-if-booted-in-secure-boot-mo.patch \

View File

@ -0,0 +1,26 @@
From 9faff3734e6456e7927c0914829a4764ec9f1b44 Mon Sep 17 00:00:00 2001
From: Adrian Vladu <avladu@cloudbasesolutions.com>
Date: Tue, 17 Sep 2024 13:44:14 +0000
Subject: [PATCH] pahole: support reproducible builds
---
scripts/Makefile.btf | 3 +++
1 file changed, 3 insertions(+)
diff --git a/scripts/Makefile.btf b/scripts/Makefile.btf
index 2d6e5ed9081e..b2f88b0fcf37 100644
--- a/scripts/Makefile.btf
+++ b/scripts/Makefile.btf
@@ -23,6 +23,9 @@ 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
+# Support reproducible builds.
+pahole-flags-$(call test-ge, $(pahole-ver), 127) = -j --btf_features=encode_force,var,float,enum64,decl_tag,type_tag,optimized_func,consistent_func,reproducible_build
+
endif
pahole-flags-$(CONFIG_PAHOLE_HAS_LANG_EXCLUDE) += --lang_exclude=rust
--
2.34.1

View File

@ -1,53 +0,0 @@
diff --git a/init/Kconfig b/init/Kconfig
index e173364abd6c..cdc35682e03b 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -1899,7 +1899,7 @@ config RUST
depends on !GCC_PLUGINS
depends on !RANDSTRUCT
depends on !SHADOW_CALL_STACK
- depends on !DEBUG_INFO_BTF || (PAHOLE_HAS_LANG_EXCLUDE && !LTO)
+ depends on !DEBUG_INFO_BTF
help
Enables Rust support in the kernel.
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index da5513cfc125..f2b3aab6d4a1 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -394,15 +394,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/pahole-flags.sh b/scripts/pahole-flags.sh
index 728d55190d97..c293941612e7 100755
--- a/scripts/pahole-flags.sh
+++ b/scripts/pahole-flags.sh
@@ -16,15 +16,5 @@ fi
if [ "${pahole_ver}" -ge "121" ]; then
extra_paholeopt="${extra_paholeopt} --btf_gen_floats"
fi
-if [ "${pahole_ver}" -ge "122" ]; then
- extra_paholeopt="${extra_paholeopt} -j"
-fi
-if [ "${pahole_ver}" -ge "124" ]; then
- # see PAHOLE_HAS_LANG_EXCLUDE
- extra_paholeopt="${extra_paholeopt} --lang_exclude=rust"
-fi
-if [ "${pahole_ver}" -ge "125" ]; then
- extra_paholeopt="${extra_paholeopt} --skip_encoding_btf_inconsistent_proto --btf_gen_optimized"
-fi
echo ${extra_paholeopt}