* [PATCH] kbuild: quote OBJCOPY var to avoid a pahole call break the build
@ 2021-05-18 14:23 Javier Martinez Canillas
2021-05-26 16:18 ` Andrii Nakryiko
0 siblings, 1 reply; 6+ messages in thread
From: Javier Martinez Canillas @ 2021-05-18 14:23 UTC (permalink / raw)
To: linux-kernel
Cc: Arnaldo Carvalho de Melo, Javier Martinez Canillas,
Alexei Starovoitov, Andrii Nakryiko, 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>
---
scripts/Makefile.modfinal | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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;
--
2.31.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] kbuild: quote OBJCOPY var to avoid a pahole call break the build
2021-05-18 14:23 [PATCH] kbuild: quote OBJCOPY var to avoid a pahole call break the build Javier Martinez Canillas
@ 2021-05-26 16:18 ` Andrii Nakryiko
2021-05-26 18:59 ` Arnaldo Carvalho de Melo
2021-05-26 19:53 ` Masahiro Yamada
0 siblings, 2 replies; 6+ messages in thread
From: Andrii Nakryiko @ 2021-05-26 16:18 UTC (permalink / raw)
To: Javier Martinez Canillas
Cc: open list, Arnaldo Carvalho de Melo, Alexei Starovoitov,
Andrii Nakryiko, Masahiro Yamada, Michal Marek,
Linux Kbuild mailing list
On Tue, May 18, 2021 at 7:23 AM 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")
> Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
> ---
>
LGTM. Masahiro, would you like us to take this through bpf tree or
you'll apply this to kbuild one?
Acked-by: Andrii Nakryiko <andrii@kernel.org>
> scripts/Makefile.modfinal | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> 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;
> --
> 2.31.1
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] kbuild: quote OBJCOPY var to avoid a pahole call break the build
2021-05-26 16:18 ` Andrii Nakryiko
@ 2021-05-26 18:59 ` Arnaldo Carvalho de Melo
2021-05-26 19:53 ` Masahiro Yamada
1 sibling, 0 replies; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2021-05-26 18:59 UTC (permalink / raw)
To: Andrii Nakryiko
Cc: Javier Martinez Canillas, open list, Alexei Starovoitov,
Andrii Nakryiko, Masahiro Yamada, Michal Marek,
Linux Kbuild mailing list
Em Wed, May 26, 2021 at 09:18:27AM -0700, Andrii Nakryiko escreveu:
> On Tue, May 18, 2021 at 7:23 AM 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")
> > Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
> > ---
> >
>
> LGTM. Masahiro, would you like us to take this through bpf tree or
> you'll apply this to kbuild one?
>
> Acked-by: Andrii Nakryiko <andrii@kernel.org>
LGTM
Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com>
- Arnaldo
> > scripts/Makefile.modfinal | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > 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;
> > --
> > 2.31.1
> >
--
- Arnaldo
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] kbuild: quote OBJCOPY var to avoid a pahole call break the build
2021-05-26 16:18 ` Andrii Nakryiko
2021-05-26 18:59 ` Arnaldo Carvalho de Melo
@ 2021-05-26 19:53 ` Masahiro Yamada
2021-05-26 21:02 ` Andrii Nakryiko
1 sibling, 1 reply; 6+ messages in thread
From: Masahiro Yamada @ 2021-05-26 19:53 UTC (permalink / raw)
To: Andrii Nakryiko
Cc: Javier Martinez Canillas, open list, Arnaldo Carvalho de Melo,
Alexei Starovoitov, Andrii Nakryiko, Michal Marek,
Linux Kbuild mailing list
On Thu, May 27, 2021 at 1:18 AM Andrii Nakryiko
<andrii.nakryiko@gmail.com> wrote:
>
> On Tue, May 18, 2021 at 7:23 AM 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-"
Actually, I did not know this...
> >
> > $ 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>
> > ---
> >
>
> LGTM. Masahiro, would you like us to take this through bpf tree or
> you'll apply this to kbuild one?
>
> Acked-by: Andrii Nakryiko <andrii@kernel.org>
>
> > scripts/Makefile.modfinal | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > 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;
> > --
> > 2.31.1
> >
Please feel free to pick it up.
I do not know 5f9ae91f7c0.
BTW, I see similar code in scripts/link-vmlinux.sh too.
LLVM_OBJCOPY=${OBJCOPY} ${PAHOLE} -J ${extra_paholeopt} ${1}
Is it OK to leave it unquoted?
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] kbuild: quote OBJCOPY var to avoid a pahole call break the build
2021-05-26 19:53 ` Masahiro Yamada
@ 2021-05-26 21:02 ` Andrii Nakryiko
2021-05-26 21:49 ` Javier Martinez Canillas
0 siblings, 1 reply; 6+ messages in thread
From: Andrii Nakryiko @ 2021-05-26 21:02 UTC (permalink / raw)
To: Masahiro Yamada
Cc: Javier Martinez Canillas, open list, Arnaldo Carvalho de Melo,
Alexei Starovoitov, Andrii Nakryiko, Michal Marek,
Linux Kbuild mailing list
On Wed, May 26, 2021 at 12:53 PM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> On Thu, May 27, 2021 at 1:18 AM Andrii Nakryiko
> <andrii.nakryiko@gmail.com> wrote:
> >
> > On Tue, May 18, 2021 at 7:23 AM 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-"
>
> Actually, I did not know this...
>
> > >
> > > $ 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>
> > > ---
> > >
> >
> > LGTM. Masahiro, would you like us to take this through bpf tree or
> > you'll apply this to kbuild one?
> >
> > Acked-by: Andrii Nakryiko <andrii@kernel.org>
> >
> > > scripts/Makefile.modfinal | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > 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;
> > > --
> > > 2.31.1
> > >
>
>
> Please feel free to pick it up.
Ok, sounds good.
> I do not know 5f9ae91f7c0.
>
> BTW, I see similar code in scripts/link-vmlinux.sh too.
>
> LLVM_OBJCOPY=${OBJCOPY} ${PAHOLE} -J ${extra_paholeopt} ${1}
>
> Is it OK to leave it unquoted?
You are right, link-vmlinux.sh should be updated accordingly.
Javier, can you please send v2 and cc bpf@vger.kernel.org? Thanks!
>
>
> --
> Best Regards
> Masahiro Yamada
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] kbuild: quote OBJCOPY var to avoid a pahole call break the build
2021-05-26 21:02 ` Andrii Nakryiko
@ 2021-05-26 21:49 ` Javier Martinez Canillas
0 siblings, 0 replies; 6+ messages in thread
From: Javier Martinez Canillas @ 2021-05-26 21:49 UTC (permalink / raw)
To: Andrii Nakryiko, Masahiro Yamada
Cc: open list, Arnaldo Carvalho de Melo, Alexei Starovoitov,
Andrii Nakryiko, Michal Marek, Linux Kbuild mailing list
On 5/26/21 11:02 PM, Andrii Nakryiko wrote:
[snip]
>>
>> BTW, I see similar code in scripts/link-vmlinux.sh too.
>>
>> LLVM_OBJCOPY=${OBJCOPY} ${PAHOLE} -J ${extra_paholeopt} ${1}
>>
>> Is it OK to leave it unquoted?
>
> You are right, link-vmlinux.sh should be updated accordingly.
>
Good catch. I'll include this in v2 as well.
> Javier, can you please send v2 and cc bpf@vger.kernel.org? Thanks!
>
Sure, thanks!
Best regards,
--
Javier Martinez Canillas
Software Engineer
New Platform Technologies Enablement team
RHEL Engineering
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-05-26 21:50 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-18 14:23 [PATCH] kbuild: quote OBJCOPY var to avoid a pahole call break the build Javier Martinez Canillas
2021-05-26 16:18 ` Andrii Nakryiko
2021-05-26 18:59 ` Arnaldo Carvalho de Melo
2021-05-26 19:53 ` Masahiro Yamada
2021-05-26 21:02 ` Andrii Nakryiko
2021-05-26 21:49 ` Javier Martinez Canillas
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.