| 1 |
From 47b0e3728f47b9babe0beadf25f77c24063decf6 Mon Sep 17 00:00:00 2001 |
| 2 |
Message-Id: <47b0e3728f47b9babe0beadf25f77c24063decf6.1685662304.git.osandov@osandov.com> |
| 3 |
From: Javier Martinez Canillas <[email protected]> |
| 4 |
Date: Wed, 26 May 2021 23:52:28 +0200 |
| 5 |
Subject: [PATCH] kbuild: Quote OBJCOPY var to avoid a pahole call break the |
| 6 |
build |
| 7 |
|
| 8 |
[ Upstream commit ff2e6efda0d5c51b33e2bcc0b0b981ac0a0ef214 ] |
| 9 |
|
| 10 |
The ccache tool can be used to speed up cross-compilation, by calling the |
| 11 |
compiler and binutils through ccache. For example, following should work: |
| 12 |
|
| 13 |
$ export ARCH=arm64 CROSS_COMPILE="ccache aarch64-linux-gnu-" |
| 14 |
|
| 15 |
$ make M=drivers/gpu/drm/rockchip/ |
| 16 |
|
| 17 |
but pahole fails to extract the BTF info from DWARF, breaking the build: |
| 18 |
|
| 19 |
CC [M] drivers/gpu/drm/rockchip//rockchipdrm.mod.o |
| 20 |
LD [M] drivers/gpu/drm/rockchip//rockchipdrm.ko |
| 21 |
BTF [M] drivers/gpu/drm/rockchip//rockchipdrm.ko |
| 22 |
aarch64-linux-gnu-objcopy: invalid option -- 'J' |
| 23 |
Usage: aarch64-linux-gnu-objcopy [option(s)] in-file [out-file] |
| 24 |
Copies a binary file, possibly transforming it in the process |
| 25 |
... |
| 26 |
make[1]: *** [scripts/Makefile.modpost:156: __modpost] Error 2 |
| 27 |
make: *** [Makefile:1866: modules] Error 2 |
| 28 |
|
| 29 |
this fails because OBJCOPY is set to "ccache aarch64-linux-gnu-copy" and |
| 30 |
later pahole is executed with the following command line: |
| 31 |
|
| 32 |
LLVM_OBJCOPY=$(OBJCOPY) $(PAHOLE) -J --btf_base vmlinux $@ |
| 33 |
|
| 34 |
which gets expanded to: |
| 35 |
|
| 36 |
LLVM_OBJCOPY=ccache aarch64-linux-gnu-objcopy pahole -J ... |
| 37 |
|
| 38 |
instead of: |
| 39 |
|
| 40 |
LLVM_OBJCOPY="ccache aarch64-linux-gnu-objcopy" pahole -J ... |
| 41 |
|
| 42 |
Fixes: 5f9ae91f7c0d ("kbuild: Build kernel module BTFs if BTF is enabled and pahole supports it") |
| 43 |
Signed-off-by: Javier Martinez Canillas <[email protected]> |
| 44 |
Signed-off-by: Andrii Nakryiko <[email protected]> |
| 45 |
Acked-by: Andrii Nakryiko <[email protected]> |
| 46 |
Acked-by: Arnaldo Carvalho de Melo <[email protected]> |
| 47 |
Link: https://lore.kernel.org/bpf/[email protected] |
| 48 |
Signed-off-by: Sasha Levin <[email protected]> |
| 49 |
--- |
| 50 |
scripts/Makefile.modfinal | 2 +- |
| 51 |
scripts/link-vmlinux.sh | 2 +- |
| 52 |
2 files changed, 2 insertions(+), 2 deletions(-) |
| 53 |
|
| 54 |
diff --git a/scripts/Makefile.modfinal b/scripts/Makefile.modfinal |
| 55 |
index 735e11e9041b..19468831fcc7 100644 |
| 56 |
--- a/scripts/Makefile.modfinal |
| 57 |
+++ b/scripts/Makefile.modfinal |
| 58 |
@@ -59,7 +59,7 @@ quiet_cmd_ld_ko_o = LD [M] $@ |
| 59 |
quiet_cmd_btf_ko = BTF [M] $@ |
| 60 |
cmd_btf_ko = \ |
| 61 |
if [ -f vmlinux ]; then \ |
| 62 |
- LLVM_OBJCOPY=$(OBJCOPY) $(PAHOLE) -J --btf_base vmlinux $@; \ |
| 63 |
+ LLVM_OBJCOPY="$(OBJCOPY)" $(PAHOLE) -J --btf_base vmlinux $@; \ |
| 64 |
else \ |
| 65 |
printf "Skipping BTF generation for %s due to unavailability of vmlinux\n" $@ 1>&2; \ |
| 66 |
fi; |
| 67 |
diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh |
| 68 |
index 3b261b0f74f0..0a16928e495b 100755 |
| 69 |
--- a/scripts/link-vmlinux.sh |
| 70 |
+++ b/scripts/link-vmlinux.sh |
| 71 |
@@ -228,7 +228,7 @@ gen_btf() |
| 72 |
vmlinux_link ${1} |
| 73 |
|
| 74 |
info "BTF" ${2} |
| 75 |
- LLVM_OBJCOPY=${OBJCOPY} ${PAHOLE} -J ${1} |
| 76 |
+ LLVM_OBJCOPY="${OBJCOPY}" ${PAHOLE} -J ${1} |
| 77 |
|
| 78 |
# Create ${2} which contains just .BTF section but no symbols. Add |
| 79 |
# SHF_ALLOC because .BTF will be part of the vmlinux image. --strip-all |
| 80 |
-- |
| 81 |
2.40.1 |
| 82 |
|