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 1/3] ARM: deprecate use of ARCH=arm for arm64 builds
Date: Wed, 10 Jun 2026 17:37:25 +0200	[thread overview]
Message-ID: <20260610153904.2862220-1-a.fatoum@barebox.org> (raw)

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




             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 Ahmad Fatoum [this message]
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

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