[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20250424-tools-cross-s390-v1-1-d3ec4b43df12@linutronix.de>
Date: Thu, 24 Apr 2025 14:00:36 +0200
From: Thomas Weißschuh <thomas.weissschuh@...utronix.de>
To: Nathan Chancellor <nathan@...nel.org>,
Nick Desaulniers <nick.desaulniers+lkml@...il.com>,
Bill Wendling <morbo@...gle.com>, Justin Stitt <justinstitt@...gle.com>,
Andrii Nakryiko <andrii@...nel.org>, Quentin Monnet <qmo@...nel.org>,
Jean-Philippe Brucker <jean-philippe@...aro.org>
Cc: linux-kernel@...r.kernel.org, llvm@...ts.linux.dev,
Thomas Weißschuh <thomas.weissschuh@...utronix.de>
Subject: [PATCH] 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@...utronix.de>
---
There doesn't seem to be a formal maintainer for this file.
Maybe the clang/llvm maintainers can pick it up.
---
tools/scripts/Makefile.include | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tools/scripts/Makefile.include b/tools/scripts/Makefile.include
index 5158250988cea8eabb0b2add34bae28c273cb997..ded48263dd5e05e174316eda7b309804923e9711 100644
--- a/tools/scripts/Makefile.include
+++ b/tools/scripts/Makefile.include
@@ -101,7 +101,9 @@ else ifneq ($(CROSS_COMPILE),)
# Allow userspace to override CLANG_CROSS_FLAGS to specify their own
# sysroots and flags or to avoid the GCC call in pure Clang builds.
ifeq ($(CLANG_CROSS_FLAGS),)
-CLANG_CROSS_FLAGS := --target=$(notdir $(CROSS_COMPILE:%-=%))
+CLANG_TARGET := $(notdir $(CROSS_COMPILE:%-=%))
+CLANG_TARGET := $(subst s390-linux,s390x-linux,$(CLANG_TARGET))
+CLANG_CROSS_FLAGS := --target=$(CLANG_TARGET)
GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)gcc 2>/dev/null))
ifneq ($(GCC_TOOLCHAIN_DIR),)
CLANG_CROSS_FLAGS += --prefix=$(GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE))
---
base-commit: 0af2f6be1b4281385b618cb86ad946eded089ac8
change-id: 20250424-tools-cross-s390-73eaa2d42833
Best regards,
--
Thomas Weißschuh <thomas.weissschuh@...utronix.de>
Powered by blists - more mailing lists