Blob Blame History Raw
From 4ef602bb5d386d55c3094b48a313c971b6fbfe8c Mon Sep 17 00:00:00 2001
From: Martin Rodriguez Reboredo <yakoyoku@gmail.com>
Date: Tue, 6 Sep 2022 15:31:23 +0200
Subject: [PATCH] kbuild: Add skip_encoding_btf_enum64 option to pahole

References: git-fixes
Patch-mainline: never, mainline supports BTF_KIND_ENUM64 since 6.0

New pahole (version 1.24) generates by default new BTF_KIND_ENUM64 BTF tag,
which is not supported by stable kernel.

As a result the kernel with CONFIG_DEBUG_INFO_BTF option will fail to
compile with following error:

  BTFIDS  vmlinux
FAILED: load BTF from vmlinux: Invalid argument

New pahole provides --skip_encoding_btf_enum64 option to skip BTF_KIND_ENUM64
generation and produce BTF supported by stable kernel.

Adding this option to scripts/pahole-flags.sh.

This change does not have equivalent commit in linus tree, because linus tree
has support for BTF_KIND_ENUM64 tag, so it does not need to be disabled.

Backport-by: NeilBrown <neilb@suse.de>
Link: https://lore.kernel.org/all/20220906132826.180891759@linuxfoundation.org/
Signed-off-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
---
 scripts/link-vmlinux.sh | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
index 4799108cad51..03ecdb8f447c 100755
--- a/scripts/link-vmlinux.sh
+++ b/scripts/link-vmlinux.sh
@@ -122,6 +122,9 @@ gen_btf()
 		# pahole 1.18 through 1.21 can't handle zero-sized per-CPU vars
 		extra_paholeopt="${extra_paholeopt} --skip_encoding_btf_vars"
 	fi
+	if [ "${pahole_ver}" -ge "124" ]; then
+		extra_paholeopt="${extra_paholeopt} --skip_encoding_btf_enum64"
+	fi
 
 	info "BTF" ${2}
 	LLVM_OBJCOPY=${OBJCOPY} ${PAHOLE} -J ${extra_paholeopt} ${1}
-- 
2.35.3