diff mbox series

[bpf] kbuild: tolerate missing pahole when generating BTF

Message ID 20190506001033.2765060-1-andriin@fb.com
State Accepted
Delegated to: BPF Maintainers
Headers show
Series [bpf] kbuild: tolerate missing pahole when generating BTF | expand

Commit Message

Andrii Nakryiko May 6, 2019, 12:10 a.m. UTC
When BTF generation is enabled through CONFIG_DEBUG_INFO_BTF,
scripts/link-vmlinux.sh detects if pahole version is too old and
gracefully continues build process, skipping BTF generation build step.
But if pahole is not available, build will still fail. This patch adds
check for whether pahole exists at all and bails out gracefully, if not.

Cc: Alexei Starovoitov <ast@fb.com>
Reported-by: Yonghong Song <yhs@fb.com>
Fixes: e83b9f55448a ("kbuild: add ability to generate BTF type info for vmlinux")
Signed-off-by: Andrii Nakryiko <andriin@fb.com>
---
 scripts/link-vmlinux.sh | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Daniel Borkmann May 6, 2019, 8:19 a.m. UTC | #1
On 05/06/2019 02:10 AM, Andrii Nakryiko wrote:
> When BTF generation is enabled through CONFIG_DEBUG_INFO_BTF,
> scripts/link-vmlinux.sh detects if pahole version is too old and
> gracefully continues build process, skipping BTF generation build step.
> But if pahole is not available, build will still fail. This patch adds
> check for whether pahole exists at all and bails out gracefully, if not.
> 
> Cc: Alexei Starovoitov <ast@fb.com>
> Reported-by: Yonghong Song <yhs@fb.com>
> Fixes: e83b9f55448a ("kbuild: add ability to generate BTF type info for vmlinux")
> Signed-off-by: Andrii Nakryiko <andriin@fb.com>

Applied, thanks!
diff mbox series

Patch

diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
index 6a148d0d51bf..e3c06b9482a2 100755
--- a/scripts/link-vmlinux.sh
+++ b/scripts/link-vmlinux.sh
@@ -96,6 +96,11 @@  gen_btf()
 {
 	local pahole_ver;
 
+	if ! [ -x "$(command -v ${PAHOLE})" ]; then
+		info "BTF" "${1}: pahole (${PAHOLE}) is not available"
+		return 0
+	fi
+
 	pahole_ver=$(${PAHOLE} --version | sed -E 's/v([0-9]+)\.([0-9]+)/\1\2/')
 	if [ "${pahole_ver}" -lt "113" ]; then
 		info "BTF" "${1}: pahole version $(${PAHOLE} --version) is too old, need at least v1.13"