All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] kbuild: quote OBJCOPY var to avoid a pahole call break the build
@ 2021-05-26 21:52 Javier Martinez Canillas
  2021-05-27 18:59 ` Andrii Nakryiko
  2021-05-27 19:00 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Javier Martinez Canillas @ 2021-05-26 21:52 UTC (permalink / raw)
  To: linux-kernel
  Cc: Arnaldo Carvalho de Melo, bpf, Javier Martinez Canillas,
	Andrii Nakryiko, Arnaldo Carvalho de Melo, Alexei Starovoitov,
	Masahiro Yamada, Michal Marek, linux-kbuild

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: 5f9ae91f7c0 ("kbuild: Build kernel module BTFs if BTF is enabled and pahole supports it")
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---

Changes in v2:
- Add collected Acked-by tags.
- Also quote on a similar assignment in scripts/link-vmlinux.sh (masahiroy)

 scripts/Makefile.modfinal | 2 +-
 scripts/link-vmlinux.sh   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/Makefile.modfinal b/scripts/Makefile.modfinal
index dd87cea9fba..a7883e45529 100644
--- a/scripts/Makefile.modfinal
+++ b/scripts/Makefile.modfinal
@@ -59,7 +59,7 @@ quiet_cmd_ld_ko_o = LD [M]  $@
 quiet_cmd_btf_ko = BTF [M] $@
       cmd_btf_ko = 							\
 	if [ -f vmlinux ]; then						\
-		LLVM_OBJCOPY=$(OBJCOPY) $(PAHOLE) -J --btf_base vmlinux $@; \
+		LLVM_OBJCOPY="$(OBJCOPY)" $(PAHOLE) -J --btf_base vmlinux $@; \
 	else								\
 		printf "Skipping BTF generation for %s due to unavailability of vmlinux\n" $@ 1>&2; \
 	fi;
diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
index f4de4c97015..0e0f6466b18 100755
--- a/scripts/link-vmlinux.sh
+++ b/scripts/link-vmlinux.sh
@@ -240,7 +240,7 @@ gen_btf()
 	fi
 
 	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.31.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] kbuild: quote OBJCOPY var to avoid a pahole call break the build
  2021-05-26 21:52 [PATCH v2] kbuild: quote OBJCOPY var to avoid a pahole call break the build Javier Martinez Canillas
@ 2021-05-27 18:59 ` Andrii Nakryiko
  2021-05-27 19:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Andrii Nakryiko @ 2021-05-27 18:59 UTC (permalink / raw)
  To: Javier Martinez Canillas
  Cc: open list, Arnaldo Carvalho de Melo, bpf, Andrii Nakryiko,
	Arnaldo Carvalho de Melo, Alexei Starovoitov, Masahiro Yamada,
	Michal Marek, Linux Kbuild mailing list

On Wed, May 26, 2021 at 2:52 PM Javier Martinez Canillas
<javierm@redhat.com> wrote:
>
> 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: 5f9ae91f7c0 ("kbuild: Build kernel module BTFs if BTF is enabled and pahole supports it")

I replaced 5f9ae91f7c0 with 5f9ae91f7c0d to have a recommended 12
characters hash. Applied to bpf tree, thanks.

> Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
> Acked-by: Andrii Nakryiko <andrii@kernel.org>
> Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> ---
>
> Changes in v2:
> - Add collected Acked-by tags.
> - Also quote on a similar assignment in scripts/link-vmlinux.sh (masahiroy)
>
>  scripts/Makefile.modfinal | 2 +-
>  scripts/link-vmlinux.sh   | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/Makefile.modfinal b/scripts/Makefile.modfinal
> index dd87cea9fba..a7883e45529 100644
> --- a/scripts/Makefile.modfinal
> +++ b/scripts/Makefile.modfinal
> @@ -59,7 +59,7 @@ quiet_cmd_ld_ko_o = LD [M]  $@
>  quiet_cmd_btf_ko = BTF [M] $@
>        cmd_btf_ko =                                                     \
>         if [ -f vmlinux ]; then                                         \
> -               LLVM_OBJCOPY=$(OBJCOPY) $(PAHOLE) -J --btf_base vmlinux $@; \
> +               LLVM_OBJCOPY="$(OBJCOPY)" $(PAHOLE) -J --btf_base vmlinux $@; \
>         else                                                            \
>                 printf "Skipping BTF generation for %s due to unavailability of vmlinux\n" $@ 1>&2; \
>         fi;
> diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
> index f4de4c97015..0e0f6466b18 100755
> --- a/scripts/link-vmlinux.sh
> +++ b/scripts/link-vmlinux.sh
> @@ -240,7 +240,7 @@ gen_btf()
>         fi
>
>         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.31.1
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] kbuild: quote OBJCOPY var to avoid a pahole call break the build
  2021-05-26 21:52 [PATCH v2] kbuild: quote OBJCOPY var to avoid a pahole call break the build Javier Martinez Canillas
  2021-05-27 18:59 ` Andrii Nakryiko
@ 2021-05-27 19:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-05-27 19:00 UTC (permalink / raw)
  To: Javier Martinez Canillas
  Cc: linux-kernel, acme, bpf, andrii, acme, ast, masahiroy,
	michal.lkml, linux-kbuild

Hello:

This patch was applied to bpf/bpf.git (refs/heads/master):

On Wed, 26 May 2021 23:52:28 +0200 you wrote:
> 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/
> 
> [...]

Here is the summary with links:
  - [v2] kbuild: quote OBJCOPY var to avoid a pahole call break the build
    https://git.kernel.org/bpf/bpf/c/ff2e6efda0d5

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-05-27 19:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-26 21:52 [PATCH v2] kbuild: quote OBJCOPY var to avoid a pahole call break the build Javier Martinez Canillas
2021-05-27 18:59 ` Andrii Nakryiko
2021-05-27 19:00 ` patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.