Skip to content

Commit 96422c5

Browse files
bjorn-rivosmehmetb0
authored andcommitted
tools: Override makefile ARCH variable if defined, but empty
BugLink: https://bugs.launchpad.net/bugs/2095283 [ Upstream commit 537a252 ] 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: 8859b0d ("tools/bpftool: Fix cross-build") Signed-off-by: Björn Töpel <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]> Tested-by: Alexandre Ghiti <[email protected]> Reviewed-by: Jean-Philippe Brucker <[email protected]> Reviewed-by: Namhyung Kim <[email protected]> Reviewed-by: Toke Høiland-Jørgensen <[email protected]> Acked-by: Quentin Monnet <[email protected]> Acked-by: Jiri Olsa <[email protected]> Cc: Arnaldo Carvalho de Melo <[email protected]> Link: https://lore.kernel.org/bpf/[email protected] Signed-off-by: Sasha Levin <[email protected]> Signed-off-by: Koichiro Den <[email protected]>
1 parent f618cb0 commit 96422c5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tools/scripts/Makefile.arch

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ HOSTARCH := $(shell uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/ \
66
-e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
77
-e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ )
88

9-
ifndef ARCH
10-
ARCH := $(HOSTARCH)
9+
ifeq ($(strip $(ARCH)),)
10+
override ARCH := $(HOSTARCH)
1111
endif
1212

1313
SRCARCH := $(ARCH)

0 commit comments

Comments
 (0)