Re: [PATCH] ARM: use a register-indirect load for TEXT_OFFSET in head.S
From: Florian Fainelli
Date: Thu Dec 03 2026 - 17:49:40 EST
On 12/1/26 14:25, Florian Fainelli wrote:
CC William,
On 12/1/26 14:06, Ard Biesheuvel wrote:
Hi Florian,
On Tue, 1 Dec 2026, at 20:18, Florian Fainelli wrote:
From: Farhad Hussain <farhad.hussain@xxxxxxxxxxxx>
add/sub with #TEXT_OFFSET requires TEXT_OFFSET to fit ARM's 8-bit
rotated immediate encoding. Platforms that need to run the kernel
from a start address above the default (e.g. to avoid colliding with
a firmware-reserved low-memory region) can end up with a TEXT_OFFSET
that no longer fits, breaking the build. Load it into a register with
ldr =TEXT_OFFSET instead, which works unconditionally and has no
effect on normal configurations where the immediate already fit.
Signed-off-by: Farhad Hussain <farhad.hussain@xxxxxxxxxxxx>
[florian: commit message, forward porting]
Signed-off-by: Florian Fainelli <florian.fainelli@xxxxxxxxxxxx>
---
arch/arm/boot/compressed/head.S | 3 ++-
arch/arm/kernel/head.S | 6 ++++--
2 files changed, 6 insertions(+), 3 deletions(-)
We currently have
arch/arm/Makefile:textofs-y := 0x00008000
arch/arm/Makefile:textofs-$(CONFIG_ARCH_REALTEK) := 0x00108000
arch/arm/Makefile:textofs-$(CONFIG_SA1111) := 0x00208000
arch/arm/Makefile:textofs-$(CONFIG_ARCH_QCOM_RESERVE_SMEM) := 0x00208000
arch/arm/Makefile:textofs-$(CONFIG_ARCH_MESON) := 0x00208000
arch/arm/Makefile:textofs-$(CONFIG_ARCH_AXXIA) := 0x00308000
none of which appear to need this. So which value of TEXT_OFFSET
are you using, and is this platform supported upstream?
The value that triggered this was 0x01008000 with ARCH_BCMBCA using OP- TEE and it was using a local textofs-y override rather than what is currently upstream.
Thanks to your message this had me go back to the SDK's history and it looks like this was corrected earlier this year to 0x8000.
Let's drop this for now, unless you object William?
Confirmed offline with William and Farhad that we don't need this patch anymore, thanks for the review and suggestions Ard.
--
Florian