linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf v2] tools: Override makefile ARCH variable if defined, but empty
@ 2024-11-27 10:17 Björn Töpel
  2024-11-27 11:53 ` Jiri Olsa
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Björn Töpel @ 2024-11-27 10:17 UTC (permalink / raw)
  To: bpf, linux-perf-users, Alexandre Ghiti, Arnaldo Carvalho de Melo,
	Jean-Philippe Brucker, Quentin Monnet, Andrii Nakryiko
  Cc: Björn Töpel, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	linux-riscv, linux-kernel, David Abdurachmanov, Namhyung Kim

From: Björn Töpel <bjorn@rivosinc.com>

There are a number of tools (bpftool, selftests), that require a
"bootstrap" build. Here, a bootstrap build is a build host variant of
a target. E.g., assume that you're performing a bpftool cross-build on
x86 to riscv, a bootstrap build would then be an x86 variant of
bpftool. The typical way to perform the host build variant, is to pass
"ARCH=" in a sub-make. However, if a variable has been set with a
command argument, then ordinary assignments in the makefile are
ignored.

This side-effect results in that ARCH, and variables depending on ARCH
are not set.

Workaround by overriding ARCH to the host arch, if ARCH is empty.

Fixes: 8859b0da5aac ("tools/bpftool: Fix cross-build")
Reviewed-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
Tested-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Reviewed-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Quentin Monnet <qmo@kernel.org>
Signed-off-by: Björn Töpel <bjorn@rivosinc.com>
---
v2: Proper tree tag "bpf".
    Collected *-by tags.

Andrii,

Apologies for missing out the tree tag in the patch. Here's a respin,
and thanks for routing it via the BPF tree.


Björn

---
 tools/scripts/Makefile.arch | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/scripts/Makefile.arch b/tools/scripts/Makefile.arch
index f6a50f06dfc4..eabfe9f411d9 100644
--- a/tools/scripts/Makefile.arch
+++ b/tools/scripts/Makefile.arch
@@ -7,8 +7,8 @@ HOSTARCH := $(shell uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/ \
                                   -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ \
                                   -e s/riscv.*/riscv/ -e s/loongarch.*/loongarch/)
 
-ifndef ARCH
-ARCH := $(HOSTARCH)
+ifeq ($(strip $(ARCH)),)
+override ARCH := $(HOSTARCH)
 endif
 
 SRCARCH := $(ARCH)

base-commit: 3448ad23b34e43a2526bd0f9e1221e8de876adec
-- 
2.45.2


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

* Re: [PATCH bpf v2] tools: Override makefile ARCH variable if defined, but empty
  2024-11-27 10:17 [PATCH bpf v2] tools: Override makefile ARCH variable if defined, but empty Björn Töpel
@ 2024-11-27 11:53 ` Jiri Olsa
  2024-11-28 13:07 ` Toke Høiland-Jørgensen
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Jiri Olsa @ 2024-11-27 11:53 UTC (permalink / raw)
  To: Björn Töpel
  Cc: bpf, linux-perf-users, Alexandre Ghiti, Arnaldo Carvalho de Melo,
	Jean-Philippe Brucker, Quentin Monnet, Andrii Nakryiko,
	Björn Töpel, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	linux-riscv, linux-kernel, David Abdurachmanov, Namhyung Kim

On Wed, Nov 27, 2024 at 11:17:46AM +0100, Björn Töpel wrote:
> From: Björn Töpel <bjorn@rivosinc.com>
> 
> There are a number of tools (bpftool, selftests), that require a
> "bootstrap" build. Here, a bootstrap build is a build host variant of
> a target. E.g., assume that you're performing a bpftool cross-build on
> x86 to riscv, a bootstrap build would then be an x86 variant of
> bpftool. The typical way to perform the host build variant, is to pass
> "ARCH=" in a sub-make. However, if a variable has been set with a
> command argument, then ordinary assignments in the makefile are
> ignored.
> 
> This side-effect results in that ARCH, and variables depending on ARCH
> are not set.
> 
> Workaround by overriding ARCH to the host arch, if ARCH is empty.
> 
> Fixes: 8859b0da5aac ("tools/bpftool: Fix cross-build")
> Reviewed-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
> Tested-by: Alexandre Ghiti <alexghiti@rivosinc.com>
> Reviewed-by: Namhyung Kim <namhyung@kernel.org>
> Acked-by: Quentin Monnet <qmo@kernel.org>
> Signed-off-by: Björn Töpel <bjorn@rivosinc.com>

Acked-by: Jiri Olsa <jolsa@kernel.org>

jirka

> ---
> v2: Proper tree tag "bpf".
>     Collected *-by tags.
> 
> Andrii,
> 
> Apologies for missing out the tree tag in the patch. Here's a respin,
> and thanks for routing it via the BPF tree.
> 
> 
> Björn
> 
> ---
>  tools/scripts/Makefile.arch | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/scripts/Makefile.arch b/tools/scripts/Makefile.arch
> index f6a50f06dfc4..eabfe9f411d9 100644
> --- a/tools/scripts/Makefile.arch
> +++ b/tools/scripts/Makefile.arch
> @@ -7,8 +7,8 @@ HOSTARCH := $(shell uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/ \
>                                    -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ \
>                                    -e s/riscv.*/riscv/ -e s/loongarch.*/loongarch/)
>  
> -ifndef ARCH
> -ARCH := $(HOSTARCH)
> +ifeq ($(strip $(ARCH)),)
> +override ARCH := $(HOSTARCH)
>  endif
>  
>  SRCARCH := $(ARCH)
> 
> base-commit: 3448ad23b34e43a2526bd0f9e1221e8de876adec
> -- 
> 2.45.2
> 
> 

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

* Re: [PATCH bpf v2] tools: Override makefile ARCH variable if defined, but empty
  2024-11-27 10:17 [PATCH bpf v2] tools: Override makefile ARCH variable if defined, but empty Björn Töpel
  2024-11-27 11:53 ` Jiri Olsa
@ 2024-11-28 13:07 ` Toke Høiland-Jørgensen
  2024-11-29 16:20 ` patchwork-bot+netdevbpf
  2024-12-11 22:32 ` patchwork-bot+linux-riscv
  3 siblings, 0 replies; 5+ messages in thread
From: Toke Høiland-Jørgensen @ 2024-11-28 13:07 UTC (permalink / raw)
  To: Björn Töpel, bpf, linux-perf-users, Alexandre Ghiti,
	Arnaldo Carvalho de Melo, Jean-Philippe Brucker, Quentin Monnet,
	Andrii Nakryiko
  Cc: Björn Töpel, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	linux-riscv, linux-kernel, David Abdurachmanov, Namhyung Kim

Björn Töpel <bjorn@kernel.org> writes:

> From: Björn Töpel <bjorn@rivosinc.com>
>
> There are a number of tools (bpftool, selftests), that require a
> "bootstrap" build. Here, a bootstrap build is a build host variant of
> a target. E.g., assume that you're performing a bpftool cross-build on
> x86 to riscv, a bootstrap build would then be an x86 variant of
> bpftool. The typical way to perform the host build variant, is to pass
> "ARCH=" in a sub-make. However, if a variable has been set with a
> command argument, then ordinary assignments in the makefile are
> ignored.
>
> This side-effect results in that ARCH, and variables depending on ARCH
> are not set.
>
> Workaround by overriding ARCH to the host arch, if ARCH is empty.
>
> Fixes: 8859b0da5aac ("tools/bpftool: Fix cross-build")
> Reviewed-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
> Tested-by: Alexandre Ghiti <alexghiti@rivosinc.com>
> Reviewed-by: Namhyung Kim <namhyung@kernel.org>
> Acked-by: Quentin Monnet <qmo@kernel.org>
> Signed-off-by: Björn Töpel <bjorn@rivosinc.com>

Reviewed-by: Toke Høiland-Jørgensen <toke@redhat.com>


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

* Re: [PATCH bpf v2] tools: Override makefile ARCH variable if defined, but empty
  2024-11-27 10:17 [PATCH bpf v2] tools: Override makefile ARCH variable if defined, but empty Björn Töpel
  2024-11-27 11:53 ` Jiri Olsa
  2024-11-28 13:07 ` Toke Høiland-Jørgensen
@ 2024-11-29 16:20 ` patchwork-bot+netdevbpf
  2024-12-11 22:32 ` patchwork-bot+linux-riscv
  3 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-11-29 16:20 UTC (permalink / raw)
  To: =?utf-8?b?QmrDtnJuIFTDtnBlbCA8Ympvcm5Aa2VybmVsLm9yZz4=?=
  Cc: bpf, linux-perf-users, alexghiti, acme, jean-philippe, qmo,
	andrii.nakryiko, bjorn, paul.walmsley, palmer, aou, linux-riscv,
	linux-kernel, davidlt, namhyung

Hello:

This patch was applied to bpf/bpf.git (master)
by Daniel Borkmann <daniel@iogearbox.net>:

On Wed, 27 Nov 2024 11:17:46 +0100 you wrote:
> From: Björn Töpel <bjorn@rivosinc.com>
> 
> There are a number of tools (bpftool, selftests), that require a
> "bootstrap" build. Here, a bootstrap build is a build host variant of
> a target. E.g., assume that you're performing a bpftool cross-build on
> x86 to riscv, a bootstrap build would then be an x86 variant of
> bpftool. The typical way to perform the host build variant, is to pass
> "ARCH=" in a sub-make. However, if a variable has been set with a
> command argument, then ordinary assignments in the makefile are
> ignored.
> 
> [...]

Here is the summary with links:
  - [bpf,v2] tools: Override makefile ARCH variable if defined, but empty
    https://git.kernel.org/bpf/bpf/c/537a2525eaf7

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] 5+ messages in thread

* Re: [PATCH bpf v2] tools: Override makefile ARCH variable if defined, but empty
  2024-11-27 10:17 [PATCH bpf v2] tools: Override makefile ARCH variable if defined, but empty Björn Töpel
                   ` (2 preceding siblings ...)
  2024-11-29 16:20 ` patchwork-bot+netdevbpf
@ 2024-12-11 22:32 ` patchwork-bot+linux-riscv
  3 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+linux-riscv @ 2024-12-11 22:32 UTC (permalink / raw)
  To: =?utf-8?b?QmrDtnJuIFTDtnBlbCA8Ympvcm5Aa2VybmVsLm9yZz4=?=
  Cc: linux-riscv, bpf, linux-perf-users, alexghiti, acme,
	jean-philippe, qmo, andrii.nakryiko, bjorn, paul.walmsley, palmer,
	aou, linux-kernel, davidlt, namhyung

Hello:

This patch was applied to riscv/linux.git (fixes)
by Daniel Borkmann <daniel@iogearbox.net>:

On Wed, 27 Nov 2024 11:17:46 +0100 you wrote:
> From: Björn Töpel <bjorn@rivosinc.com>
> 
> There are a number of tools (bpftool, selftests), that require a
> "bootstrap" build. Here, a bootstrap build is a build host variant of
> a target. E.g., assume that you're performing a bpftool cross-build on
> x86 to riscv, a bootstrap build would then be an x86 variant of
> bpftool. The typical way to perform the host build variant, is to pass
> "ARCH=" in a sub-make. However, if a variable has been set with a
> command argument, then ordinary assignments in the makefile are
> ignored.
> 
> [...]

Here is the summary with links:
  - [bpf,v2] tools: Override makefile ARCH variable if defined, but empty
    https://git.kernel.org/riscv/c/537a2525eaf7

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] 5+ messages in thread

end of thread, other threads:[~2024-12-11 22:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-27 10:17 [PATCH bpf v2] tools: Override makefile ARCH variable if defined, but empty Björn Töpel
2024-11-27 11:53 ` Jiri Olsa
2024-11-28 13:07 ` Toke Høiland-Jørgensen
2024-11-29 16:20 ` patchwork-bot+netdevbpf
2024-12-11 22:32 ` patchwork-bot+linux-riscv

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).