* [PATCH 1/3] ARM: deprecate use of ARCH=arm for arm64 builds
@ 2026-06-10 15:37 Ahmad Fatoum
2026-06-10 15:37 ` [PATCH 2/3] Makefile: clang: fix triplet computation for ARM Ahmad Fatoum
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Ahmad Fatoum @ 2026-06-10 15:37 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
Linux has separate arch/arm and arch/arm64, where each is built by
ARCH=arm and ARCH=arm64, respectively.
barebox has arch/arm for both, which leads to issues from time to time:
- Ported kernel code may assume SRCARCH to differ between arm32
and arm64[1].
- It's not possible to determine if we are going to build for 32-bit
ARM or 64-bit ARM before reading and normalizing the config[2].
To be able to, someday, resolve these issues, let's throw a warning
when ARCH=arm is used when it later turns out that ARCH=arm64 would
have been more correct and vice versa.
[1]: https://lore.kernel.org/barebox/20260610135904.2717667-1-a.fatoum@barebox.org/T/#u
[2]: 92d503132efc ("Revert "MAKEALL: query CONFIG_64BIT before make instead of CONFIG_ARM64 after"")
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
Documentation/migration-guides/migration-master.rst | 8 ++++++++
arch/arm/Kconfig | 7 +++++++
arch/arm/Makefile | 10 ++++++++++
3 files changed, 25 insertions(+)
create mode 100644 Documentation/migration-guides/migration-master.rst
diff --git a/Documentation/migration-guides/migration-master.rst b/Documentation/migration-guides/migration-master.rst
new file mode 100644
index 000000000000..455863357d1d
--- /dev/null
+++ b/Documentation/migration-guides/migration-master.rst
@@ -0,0 +1,8 @@
+:orphan:
+
+ARCH=arm64
+----------
+
+Use of ``ARCH=arm`` for 64-bit ARM builds is deprecated and now emits
+a warning. Users should change build scripts to use ``ARCH=arm64``
+instead when targetting ARMv8.
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index cb6652001546..63877c965fad 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -41,6 +41,13 @@ config ARM64
select ARCH_HAS_RELR
select ARCH_HAS_BAREBOX_MEMORY_OFFSET
+config ARM64_STRICT_BUILD_ARCH
+ bool
+ depends on ARM64
+ help
+ When selected, ARCH=arm64 is required for 64-bit builds and ARCH=arm
+ will fail. When not selected, a deprecation warning is printed.
+
config ARCH_TEXT_BASE
hex
default 0x00000000
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index eb4c634c42ec..edf6f7d74eb5 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -18,10 +18,20 @@ KBUILD_CPPFLAGS += -D__ARM__ -fno-strict-aliasing
# Explicitly specifiy 32-bit ARM ISA since toolchain default can be -mthumb:
ifeq ($(CONFIG_CPU_64),y)
KBUILD_CPPFLAGS +=$(call cc-option,-maarch64,)
+ifneq ($(UTS_MACHINE),arm64)
+ifdef CONFIG_ARM64_STRICT_BUILD_ARCH
+$(error Deprecated use of ARCH=arm in 64-bit ARM build! Set ARCH=arm64 instead.)
+else
+$(warning Deprecated use of ARCH=arm in 64-bit ARM build! Set ARCH=arm64 instead.)
+endif
+endif
endif
ifeq ($(CONFIG_CPU_32),y)
KBUILD_CPPFLAGS +=$(call cc-option,-marm,)
KBUILD_CPPFLAGS += -msoft-float
+ifeq ($(UTS_MACHINE),arm64)
+$(error Erroneous use of ARCH=arm64 in 32-bit ARM build! Set ARCH=arm instead.)
+endif
endif
ifeq ($(CONFIG_CPU_BIG_ENDIAN),y)
--
2.47.3
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH 2/3] Makefile: clang: fix triplet computation for ARM
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
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
2 siblings, 0 replies; 4+ messages in thread
From: Ahmad Fatoum @ 2026-06-10 15:37 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
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
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH 3/3] ARM64: suppress -mabi=lp64 when built with clang
2026-06-10 15:37 [PATCH 1/3] ARM: deprecate use of ARCH=arm for arm64 builds Ahmad Fatoum
2026-06-10 15:37 ` [PATCH 2/3] Makefile: clang: fix triplet computation for ARM Ahmad Fatoum
@ 2026-06-10 15:37 ` Ahmad Fatoum
2026-06-15 8:11 ` [PATCH 1/3] ARM: deprecate use of ARCH=arm for arm64 builds Sascha Hauer
2 siblings, 0 replies; 4+ messages in thread
From: Ahmad Fatoum @ 2026-06-10 15:37 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
Linux also drops this option when built with clang, so do likewise in
barebox.
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
arch/arm/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index edf6f7d74eb5..94904fee13e8 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -75,7 +75,7 @@ tune-$(CONFIG_CPU_ARM920T) :=-mtune=arm9tdmi
tune-$(CONFIG_CPU_ARM926T) :=-mtune=arm9tdmi
tune-$(CONFIG_CPU_XSCALE) :=$(call cc-option,-mtune=xscale,-mtune=strongarm110) -Wa,-mcpu=xscale
-CFLAGS_ABI-$(CONFIG_CPU_64) :=-mabi=lp64
+CFLAGS_ABI-$(CONFIG_CPU_64) :=$(call cc-option,-mabi=lp64)
CFLAGS_ABI-$(CONFIG_CPU_32) :=$(call cc-option,-mapcs-32,-mabi=apcs-gnu) $(call cc-option,-mno-thumb-interwork,)
CFLAGS_ABI-$(CONFIG_AEABI) :=-mabi=aapcs-linux
--
2.47.3
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/3] ARM: deprecate use of ARCH=arm for arm64 builds
2026-06-10 15:37 [PATCH 1/3] ARM: deprecate use of ARCH=arm for arm64 builds Ahmad Fatoum
2026-06-10 15:37 ` [PATCH 2/3] Makefile: clang: fix triplet computation for ARM Ahmad Fatoum
2026-06-10 15:37 ` [PATCH 3/3] ARM64: suppress -mabi=lp64 when built with clang Ahmad Fatoum
@ 2026-06-15 8:11 ` Sascha Hauer
2 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2026-06-15 8:11 UTC (permalink / raw)
To: barebox, Ahmad Fatoum
On Wed, 10 Jun 2026 17:37:25 +0200, Ahmad Fatoum wrote:
> Linux has separate arch/arm and arch/arm64, where each is built by
> ARCH=arm and ARCH=arm64, respectively.
>
> barebox has arch/arm for both, which leads to issues from time to time:
>
> - Ported kernel code may assume SRCARCH to differ between arm32
> and arm64[1].
>
> [...]
Applied, thanks!
[1/3] ARM: deprecate use of ARCH=arm for arm64 builds
https://git.pengutronix.de/cgit/barebox/commit/?id=eacdb0c02567 (link may not be stable)
[2/3] Makefile: clang: fix triplet computation for ARM
https://git.pengutronix.de/cgit/barebox/commit/?id=bbc6ca801f3c (link may not be stable)
[3/3] ARM64: suppress -mabi=lp64 when built with clang
https://git.pengutronix.de/cgit/barebox/commit/?id=6cb61d165af1 (link may not be stable)
Best regards,
--
Sascha Hauer <s.hauer@pengutronix.de>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-06-15 8:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-10 15:37 [PATCH 1/3] ARM: deprecate use of ARCH=arm for arm64 builds Ahmad Fatoum
2026-06-10 15:37 ` [PATCH 2/3] Makefile: clang: fix triplet computation for ARM Ahmad Fatoum
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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox