Skip to content

Commit a40f0cd

Browse files
committed
tools/build: Fix s390(x) cross-compilation with clang
The heuristic to derive a clang target triple from a GCC one does not work for s390. GCC uses "s390-linux" while clang expects "s390x-linux" or "powerz-linux". Add an explicit override. Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de> Link: https://lore.kernel.org/r/20250620-tools-cross-s390-v2-1-ecda886e00e5@linutronix.de Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
1 parent 31db7b6 commit a40f0cd

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

tools/scripts/Makefile.include

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,9 @@ else ifneq ($(CROSS_COMPILE),)
101101
# Allow userspace to override CLANG_CROSS_FLAGS to specify their own
102102
# sysroots and flags or to avoid the GCC call in pure Clang builds.
103103
ifeq ($(CLANG_CROSS_FLAGS),)
104-
CLANG_CROSS_FLAGS := --target=$(notdir $(CROSS_COMPILE:%-=%))
104+
CLANG_TARGET := $(notdir $(CROSS_COMPILE:%-=%))
105+
CLANG_TARGET := $(subst s390-linux,s390x-linux,$(CLANG_TARGET))
106+
CLANG_CROSS_FLAGS := --target=$(CLANG_TARGET)
105107
GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)gcc 2>/dev/null))
106108
ifneq ($(GCC_TOOLCHAIN_DIR),)
107109
CLANG_CROSS_FLAGS += --prefix=$(GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE))

0 commit comments

Comments
 (0)