linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] tools/build: Fix s390(x) cross-compilation with clang
@ 2025-06-20 11:00 Thomas Weißschuh
  2025-06-20 11:00 ` [PATCH v2 1/2] " Thomas Weißschuh
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Thomas Weißschuh @ 2025-06-20 11:00 UTC (permalink / raw)
  To: Nathan Chancellor, Nick Desaulniers, Bill Wendling, Justin Stitt,
	Andrii Nakryiko, Quentin Monnet, Jean-Philippe Brucker,
	Willy Tarreau, Thomas Weißschuh
  Cc: linux-kernel, llvm, Thomas Weißschuh

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".

There doesn't seem to be a formal maintainer for this file.
Maybe the clang/llvm maintainers can pick it up.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
---
Changes in v2:
- Rebase onto mainline master
- Drop custom nolibc workaround
- Link to v1: https://lore.kernel.org/r/20250424-tools-cross-s390-v1-1-d3ec4b43df12@linutronix.de

---
Thomas Weißschuh (2):
      tools/build: Fix s390(x) cross-compilation with clang
      tools/nolibc: drop s390 clang target override

 tools/include/nolibc/Makefile  | 3 ---
 tools/scripts/Makefile.include | 4 +++-
 2 files changed, 3 insertions(+), 4 deletions(-)
---
base-commit: 75f5f23f8787c5e184fcb2fbcd02d8e9317dc5e7
change-id: 20250424-tools-cross-s390-73eaa2d42833

Best regards,
-- 
Thomas Weißschuh <thomas.weissschuh@linutronix.de>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2 1/2] tools/build: Fix s390(x) cross-compilation with clang
  2025-06-20 11:00 [PATCH v2 0/2] tools/build: Fix s390(x) cross-compilation with clang Thomas Weißschuh
@ 2025-06-20 11:00 ` Thomas Weißschuh
  2025-06-20 11:00 ` [PATCH v2 2/2] tools/nolibc: drop s390 clang target override Thomas Weißschuh
  2025-07-02 21:41 ` [PATCH v2 0/2] tools/build: Fix s390(x) cross-compilation with clang Nathan Chancellor
  2 siblings, 0 replies; 5+ messages in thread
From: Thomas Weißschuh @ 2025-06-20 11:00 UTC (permalink / raw)
  To: Nathan Chancellor, Nick Desaulniers, Bill Wendling, Justin Stitt,
	Andrii Nakryiko, Quentin Monnet, Jean-Philippe Brucker,
	Willy Tarreau, Thomas Weißschuh
  Cc: linux-kernel, llvm, Thomas Weißschuh

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>
---
 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))

-- 
2.49.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v2 2/2] tools/nolibc: drop s390 clang target override
  2025-06-20 11:00 [PATCH v2 0/2] tools/build: Fix s390(x) cross-compilation with clang Thomas Weißschuh
  2025-06-20 11:00 ` [PATCH v2 1/2] " Thomas Weißschuh
@ 2025-06-20 11:00 ` Thomas Weißschuh
  2025-07-02 21:41 ` [PATCH v2 0/2] tools/build: Fix s390(x) cross-compilation with clang Nathan Chancellor
  2 siblings, 0 replies; 5+ messages in thread
From: Thomas Weißschuh @ 2025-06-20 11:00 UTC (permalink / raw)
  To: Nathan Chancellor, Nick Desaulniers, Bill Wendling, Justin Stitt,
	Andrii Nakryiko, Quentin Monnet, Jean-Philippe Brucker,
	Willy Tarreau, Thomas Weißschuh
  Cc: linux-kernel, llvm, Thomas Weißschuh

tools/scripts/Makefile.include now has the same override,
removing the need for the one in the nolibc Makefile.

Drop the superfluous custom override.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
---
 tools/include/nolibc/Makefile | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/tools/include/nolibc/Makefile b/tools/include/nolibc/Makefile
index c335ce0bd195c1ec63b9b23c0143307acfd3d3c8..3b3ff0505a5f5fea493d6a77faf44759925ff2b0 100644
--- a/tools/include/nolibc/Makefile
+++ b/tools/include/nolibc/Makefile
@@ -114,9 +114,6 @@ headers_standalone: headers
 	$(Q)$(MAKE) -C $(srctree) headers
 	$(Q)$(MAKE) -C $(srctree) headers_install INSTALL_HDR_PATH=$(OUTPUT)sysroot
 
-# GCC uses "s390", clang "systemz"
-CLANG_CROSS_FLAGS := $(subst --target=s390-linux,--target=systemz-linux,$(CLANG_CROSS_FLAGS))
-
 headers_check: headers_standalone
 	for header in $(filter-out crt.h std.h,$(all_files)); do \
 		$(CC) $(CLANG_CROSS_FLAGS) -Wall -Werror -nostdinc -fsyntax-only -x c /dev/null \

-- 
2.49.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 0/2] tools/build: Fix s390(x) cross-compilation with clang
  2025-06-20 11:00 [PATCH v2 0/2] tools/build: Fix s390(x) cross-compilation with clang Thomas Weißschuh
  2025-06-20 11:00 ` [PATCH v2 1/2] " Thomas Weißschuh
  2025-06-20 11:00 ` [PATCH v2 2/2] tools/nolibc: drop s390 clang target override Thomas Weißschuh
@ 2025-07-02 21:41 ` Nathan Chancellor
  2025-07-04 11:41   ` Thomas Weißschuh
  2 siblings, 1 reply; 5+ messages in thread
From: Nathan Chancellor @ 2025-07-02 21:41 UTC (permalink / raw)
  To: Thomas Weißschuh
  Cc: Nick Desaulniers, Bill Wendling, Justin Stitt, Andrii Nakryiko,
	Quentin Monnet, Jean-Philippe Brucker, Willy Tarreau,
	Thomas Weißschuh, linux-kernel, llvm

On Fri, Jun 20, 2025 at 01:00:26PM +0200, Thomas Weißschuh wrote:
> 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".

This generally seems fine to me but I do not interact with tools/ much.

> There doesn't seem to be a formal maintainer for this file.
> Maybe the clang/llvm maintainers can pick it up.

I do not have a tree nor do I send pull requests to Linus. Perhaps you
could just pick this up in the nolibc tree or have Shuah take it as a
greater kselftests update?

Cheers,
Nathan

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 0/2] tools/build: Fix s390(x) cross-compilation with clang
  2025-07-02 21:41 ` [PATCH v2 0/2] tools/build: Fix s390(x) cross-compilation with clang Nathan Chancellor
@ 2025-07-04 11:41   ` Thomas Weißschuh
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Weißschuh @ 2025-07-04 11:41 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Nick Desaulniers, Bill Wendling, Justin Stitt, Andrii Nakryiko,
	Quentin Monnet, Jean-Philippe Brucker, Willy Tarreau,
	Thomas Weißschuh, linux-kernel, llvm

Hi Nathan,

On Wed, Jul 02, 2025 at 02:41:33PM -0700, Nathan Chancellor wrote:
> On Fri, Jun 20, 2025 at 01:00:26PM +0200, Thomas Weißschuh wrote:
> > 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".
> 
> This generally seems fine to me but I do not interact with tools/ much.

Is it enough for a formal Reviewed-by?

> > There doesn't seem to be a formal maintainer for this file.
> > Maybe the clang/llvm maintainers can pick it up.
> 
> I do not have a tree nor do I send pull requests to Linus. Perhaps you
> could just pick this up in the nolibc tree or have Shuah take it as a
> greater kselftests update?

It's not really only related to kselftest either.
But I'll ping Shuah. Otherwise I'll indeed take it directly.

Thanks,
Thomas

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-07-04 11:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-20 11:00 [PATCH v2 0/2] tools/build: Fix s390(x) cross-compilation with clang Thomas Weißschuh
2025-06-20 11:00 ` [PATCH v2 1/2] " Thomas Weißschuh
2025-06-20 11:00 ` [PATCH v2 2/2] tools/nolibc: drop s390 clang target override Thomas Weißschuh
2025-07-02 21:41 ` [PATCH v2 0/2] tools/build: Fix s390(x) cross-compilation with clang Nathan Chancellor
2025-07-04 11:41   ` Thomas Weißschuh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).