This is an automated email from the ASF dual-hosted git repository.
xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 325ff9321b2 libs/libc/machine/arm64: Keep ADRP when the erratum 843419
ADR cannot reach.
325ff9321b2 is described below
commit 325ff9321b20209cf49d7578c81c1168cc0a8fe0
Author: Marco Casaroli <[email protected]>
AuthorDate: Fri Oct 9 00:17:03 2026 +0200
libs/libc/machine/arm64: Keep ADRP when the erratum 843419 ADR cannot reach.
For an ADRP at page offset 0xff8 or 0xffc, the relocation code rewrites
it as ADR to avoid Cortex-A53 erratum 843419. ADR reaches only 1 MB,
so a module with more than about 1 MB between an instruction and its
data failed to load with EINVAL ("Out of range for ADR").
Keep the ADRP in that case. It reaches 4 GB.
Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Marco Casaroli <[email protected]>
---
libs/libc/machine/arm64/arch_elf.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/libs/libc/machine/arm64/arch_elf.c
b/libs/libc/machine/arm64/arch_elf.c
index 210409a64fa..62e578c7e1a 100644
--- a/libs/libc/machine/arm64/arch_elf.c
+++ b/libs/libc/machine/arm64/arch_elf.c
@@ -724,8 +724,12 @@ int up_relocateadd(const Elf64_Rela *rel, const Elf64_Sym
*sym,
}
else
{
- berr("Out of range for ADR\n");
- return -EINVAL;
+ /* The erratum 843419 workaround needs the target within
+ * 1 MB. Otherwise keep the ADRP: it reaches 4 GB.
+ */
+
+ ret = reloc_insn_imm(RELOC_OP_PAGE, addr, val, 12, 21,
+ INSN_IMM_ADR);
}
}
}