mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@barebox.org>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@barebox.org>
Subject: [PATCH 2/3] Makefile: clang: fix triplet computation for ARM
Date: Wed, 10 Jun 2026 17:37:26 +0200	[thread overview]
Message-ID: <20260610153904.2862220-2-a.fatoum@barebox.org> (raw)
In-Reply-To: <20260610153904.2862220-1-a.fatoum@barebox.org>

The code that has been imported here is wrong, because it doesn't
account for the fact that SRCARCH in barebox is never arm64, even for
CONFIG_ARM64. This is not trivially fixable directly as this file is
included before CONFIG_ options are available, so we can't actually know
whether it's arm64 or arm32...

Fix this by requiring ARCH=arm64 to be used for 64-bit builds with clang.
At some point in the future, we can enforce this for everyone.

Note that clang building is currently only supported and tested for
sandbox, but with this change, everyone can see the errors and
collaboration on enabling clang support becomes feasible.

Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
 arch/arm/Kconfig       | 2 +-
 scripts/Makefile.clang | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 63877c965fad..fe4fd3f47178 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -42,7 +42,7 @@ config ARM64
 	select ARCH_HAS_BAREBOX_MEMORY_OFFSET
 
 config ARM64_STRICT_BUILD_ARCH
-	bool
+	def_bool CC_IS_CLANG
 	depends on ARM64
 	help
 	  When selected, ARCH=arm64 is required for 64-bit builds and ARCH=arm
diff --git a/scripts/Makefile.clang b/scripts/Makefile.clang
index e93ffb77aa10..fca1b8eee985 100644
--- a/scripts/Makefile.clang
+++ b/scripts/Makefile.clang
@@ -2,8 +2,9 @@
 # Individual arch/{arch}/Makefiles should use -EL/-EB to set intended
 # endianness and -m32/-m64 to set word size based on Kconfigs instead of
 # relying on the target triple.
-CLANG_TARGET_FLAGS_arm		:= arm-linux-gnueabi
-CLANG_TARGET_FLAGS_arm64	:= aarch64-linux-gnu
+CLANG_TARGET_FLAGS-arm		:= arm-linux-gnueabi
+CLANG_TARGET_FLAGS-arm64	:= aarch64-linux-gnu
+CLANG_TARGET_FLAGS_arm		:= $(CLANG_TARGET_FLAGS-$(UTS_MACHINE))
 CLANG_TARGET_FLAGS_mips		:= mipsel-linux-gnu
 CLANG_TARGET_FLAGS_powerpc	:= powerpc64le-linux-gnu
 CLANG_TARGET_FLAGS_riscv	:= riscv64-linux-gnu
-- 
2.47.3




  reply	other threads:[~2026-06-10 15:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-10 15:37 [PATCH 1/3] ARM: deprecate use of ARCH=arm for arm64 builds Ahmad Fatoum
2026-06-10 15:37 ` Ahmad Fatoum [this message]
2026-06-10 15:37 ` [PATCH 3/3] ARM64: suppress -mabi=lp64 when built with clang Ahmad Fatoum
2026-06-15  8:11 ` [PATCH 1/3] ARM: deprecate use of ARCH=arm for arm64 builds Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260610153904.2862220-2-a.fatoum@barebox.org \
    --to=a.fatoum@barebox.org \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox