Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Thomas Weißschuh and committed by
Thomas Weißschuh
a40f0cdc 31db7b6a

+3 -1
+3 -1
tools/scripts/Makefile.include
··· 101 101 # Allow userspace to override CLANG_CROSS_FLAGS to specify their own 102 102 # sysroots and flags or to avoid the GCC call in pure Clang builds. 103 103 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) 105 107 GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)gcc 2>/dev/null)) 106 108 ifneq ($(GCC_TOOLCHAIN_DIR),) 107 109 CLANG_CROSS_FLAGS += --prefix=$(GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE))