mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-12-28 16:56:26 +00:00
537a2525ea
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: 8859b0da5a
("tools/bpftool: Fix cross-build")
Signed-off-by: Björn Töpel <bjorn@rivosinc.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Tested-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Reviewed-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
Reviewed-by: Namhyung Kim <namhyung@kernel.org>
Reviewed-by: Toke Høiland-Jørgensen <toke@redhat.com>
Acked-by: Quentin Monnet <qmo@kernel.org>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Link: https://lore.kernel.org/bpf/20241127101748.165693-1-bjorn@kernel.org
47 lines
1.2 KiB
Makefile
47 lines
1.2 KiB
Makefile
# SPDX-License-Identifier: GPL-2.0
|
|
HOSTARCH := $(shell uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/ \
|
|
-e s/sun4u/sparc/ -e s/sparc64/sparc/ \
|
|
-e /arm64/!s/arm.*/arm/ -e s/sa110/arm/ \
|
|
-e s/s390x/s390/ -e s/parisc64/parisc/ \
|
|
-e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
|
|
-e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ \
|
|
-e s/riscv.*/riscv/ -e s/loongarch.*/loongarch/)
|
|
|
|
ifeq ($(strip $(ARCH)),)
|
|
override ARCH := $(HOSTARCH)
|
|
endif
|
|
|
|
SRCARCH := $(ARCH)
|
|
|
|
# Additional ARCH settings for x86
|
|
ifeq ($(ARCH),i386)
|
|
SRCARCH := x86
|
|
endif
|
|
ifeq ($(ARCH),x86_64)
|
|
SRCARCH := x86
|
|
endif
|
|
|
|
# Additional ARCH settings for sparc
|
|
ifeq ($(ARCH),sparc32)
|
|
SRCARCH := sparc
|
|
endif
|
|
ifeq ($(ARCH),sparc64)
|
|
SRCARCH := sparc
|
|
endif
|
|
|
|
# Additional ARCH settings for loongarch
|
|
ifeq ($(ARCH),loongarch32)
|
|
SRCARCH := loongarch
|
|
endif
|
|
|
|
ifeq ($(ARCH),loongarch64)
|
|
SRCARCH := loongarch
|
|
endif
|
|
|
|
LP64 := $(shell echo __LP64__ | ${CC} ${CFLAGS} -E -x c - | tail -n 1)
|
|
ifeq ($(LP64), 1)
|
|
IS_64_BIT := 1
|
|
else
|
|
IS_64_BIT := 0
|
|
endif
|