From: Kienan Stewart Date: Mon, 28 Aug 2023 19:41:42 +0000 (-0400) Subject: jjb: Add workaround for newer pahole versions with focal kernels X-Git-Url: http://git.liburcu.org/?a=commitdiff_plain;h=23ebcd4b370980c414eee8837d5351a64e41221f;p=lttng-ci.git jjb: Add workaround for newer pahole versions with focal kernels Change-Id: I4d5f175cadd27bf06dc4af9351e1cb1b2baa3bb9 --- diff --git a/scripts/lttng-modules/param-build.sh b/scripts/lttng-modules/param-build.sh index b655bb7..6a96fc0 100644 --- a/scripts/lttng-modules/param-build.sh +++ b/scripts/lttng-modules/param-build.sh @@ -230,6 +230,7 @@ build_linux_kernel() { cd "$LINUX_SRCOBJ_DIR" kversion=$(make -s kernelversion "${make_args[@]}") + pahole_version="$(pahole --version | tr -d 'v')" if { verlt "${kversion}" "3.3"; } && [ "${vanilla_config}" = "imx_v6_v7_defconfig" ] ; then # imx_v6_v7 didn't exist before 06965c39b4c63933fa0a1cde2237ef85477c5655 @@ -481,6 +482,28 @@ EOF fi fi + if [ "$(scripts/config --state CONFIG_DEBUG_INFO_BTF)" == "y" ] && + { vergte "${pahole_version}" "1.24"; } && + { vergte "${kversion}" "5.10"; } && { verlt "${kversion}" "6.0"; } ;then + # Some kernels Eg. Ubuntu-hwe-5.13-5.13.0-52.59_20.04.1 + # fail with the following error: + # BTFIDS vmlinux + # FAILED: load BTF from vmlinux: Invalid argument + # + # When CONFIG_DEBUG_INFO_BTF is set, certain versions of pahole require + # `--skip_encoding_btf_enum64` to be passed as the kernel doesn't define + # BTF_KIND_ENUM64. + # + # Introduced in 341dfcf8d78eaa3a2dc96dea06f0392eb2978364 (~v5.10) + # @see https://lore.kernel.org/bpf/20220825171620.cioobudss6ovyrkc@altlinux.org/t/ + # + if [ -f "scripts/pahole-flags.sh" ] ; then + sed -i 's/ -J ${PAHOLE_FLAGS} / -J ${PAHOLE_FLAGS} --skip_encoding_btf_enum64 /' scripts/link-vmlinux.sh + else + sed -i 's/ -J ${extra_paholeopt} / -J ${extra_paholeopt} --skip_encoding_btf_enum64 /' scripts/link-vmlinux.sh + fi + fi + # GCC 4.8 if [ "$HOSTCC" == "gcc-4.8" ]; then scripts/config --disable CONFIG_CC_STACKPROTECTOR_STRONG