public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@kernel.org>
To: stable@vger.kernel.org
Cc: "Andrii Nakryiko" <andrii@kernel.org>,
	"Arnaldo Carvalho de Melo" <acme@redhat.com>,
	bpf@vger.kernel.org, "Arnaldo Carvalho de Melo" <acme@kernel.org>,
	"Daniel Borkmann" <daniel@iogearbox.net>,
	"Martin Rodriguez Reboredo" <yakoyoku@gmail.com>,
	"Javier Martinez Canillas" <javierm@redhat.com>,
	"Ilya Leoshkevich" <iii@linux.ibm.com>,
	"Nathan Chancellor" <nathan@kernel.org>,
	"Philip Müller" <philm@manjaro.org>
Subject: [PATCH stable 5.10 2/5] kbuild: Quote OBJCOPY var to avoid a pahole call break the build
Date: Wed, 19 Oct 2022 10:56:01 +0200	[thread overview]
Message-ID: <20221019085604.1017583-3-jolsa@kernel.org> (raw)
In-Reply-To: <20221019085604.1017583-1-jolsa@kernel.org>

From: Javier Martinez Canillas <javierm@redhat.com>

commit ff2e6efda0d5c51b33e2bcc0b0b981ac0a0ef214 upstream.

[backported for dependency, skipped Makefile.modfinal change,
because module BTF is not supported in 5.10]

The ccache tool can be used to speed up cross-compilation, by calling the
compiler and binutils through ccache. For example, following should work:

    $ export ARCH=arm64 CROSS_COMPILE="ccache aarch64-linux-gnu-"

    $ make M=drivers/gpu/drm/rockchip/

but pahole fails to extract the BTF info from DWARF, breaking the build:

      CC [M]  drivers/gpu/drm/rockchip//rockchipdrm.mod.o
      LD [M]  drivers/gpu/drm/rockchip//rockchipdrm.ko
      BTF [M] drivers/gpu/drm/rockchip//rockchipdrm.ko
    aarch64-linux-gnu-objcopy: invalid option -- 'J'
    Usage: aarch64-linux-gnu-objcopy [option(s)] in-file [out-file]
     Copies a binary file, possibly transforming it in the process
    ...
    make[1]: *** [scripts/Makefile.modpost:156: __modpost] Error 2
    make: *** [Makefile:1866: modules] Error 2

this fails because OBJCOPY is set to "ccache aarch64-linux-gnu-copy" and
later pahole is executed with the following command line:

    LLVM_OBJCOPY=$(OBJCOPY) $(PAHOLE) -J --btf_base vmlinux $@

which gets expanded to:

    LLVM_OBJCOPY=ccache aarch64-linux-gnu-objcopy pahole -J ...

instead of:

    LLVM_OBJCOPY="ccache aarch64-linux-gnu-objcopy" pahole -J ...

Fixes: 5f9ae91f7c0d ("kbuild: Build kernel module BTFs if BTF is enabled and pahole supports it")
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Link: https://lore.kernel.org/bpf/20210526215228.3729875-1-javierm@redhat.com
---
 scripts/link-vmlinux.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
index cdfccbfed452..72bf14df6903 100755
--- a/scripts/link-vmlinux.sh
+++ b/scripts/link-vmlinux.sh
@@ -162,7 +162,7 @@ gen_btf()
 	vmlinux_link ${1}
 
 	info "BTF" ${2}
-	LLVM_OBJCOPY=${OBJCOPY} ${PAHOLE} -J ${extra_paholeopt} ${1}
+	LLVM_OBJCOPY="${OBJCOPY}" ${PAHOLE} -J ${extra_paholeopt} ${1}
 
 	# Create ${2} which contains just .BTF section but no symbols. Add
 	# SHF_ALLOC because .BTF will be part of the vmlinux image. --strip-all
-- 
2.37.3


  parent reply	other threads:[~2022-10-19  9:05 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-19  8:55 [PATCH stable 5.10 0/5] kbuild: Fix compilation for latest pahole release Jiri Olsa
2022-10-19  8:56 ` [PATCH stable 5.10 1/5] bpf: Generate BTF_KIND_FLOAT when linking vmlinux Jiri Olsa
2022-10-19  8:56 ` Jiri Olsa [this message]
2022-10-19 10:28   ` [PATCH stable 5.10 2/5] kbuild: Quote OBJCOPY var to avoid a pahole call break the build Greg KH
2022-10-19 11:18     ` Jiri Olsa
2022-10-19  8:56 ` [PATCH stable 5.10 3/5] kbuild: skip per-CPU BTF generation for pahole v1.18-v1.21 Jiri Olsa
2022-10-19  8:56 ` [PATCH stable 5.10 4/5] kbuild: Unify options for BTF generation for vmlinux and modules Jiri Olsa
2022-10-19  8:56 ` [PATCH stable 5.10 5/5] kbuild: Add skip_encoding_btf_enum64 option to pahole Jiri Olsa
2022-10-19 14:55 ` [PATCH stable 5.10 0/5] kbuild: Fix compilation for latest pahole release Greg KH
2022-10-19 15:30   ` Jiri Olsa
2022-10-26 16:44 ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221019085604.1017583-3-jolsa@kernel.org \
    --to=jolsa@kernel.org \
    --cc=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=andrii@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=iii@linux.ibm.com \
    --cc=javierm@redhat.com \
    --cc=nathan@kernel.org \
    --cc=philm@manjaro.org \
    --cc=stable@vger.kernel.org \
    --cc=yakoyoku@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox