[PATCH v3 4/4] arm64: Trap non-PIE builds early if starting from wrong address
Edgar E. Iglesias
edgar.iglesias at gmail.com
Wed Sep 9 19:07:27 CEST 2020
From: "Edgar E. Iglesias" <edgar.iglesias at xilinx.com>
Trap non-PIE builds early if the start address doesn't match
between run-time and link-time. This will trap the startup
sequence rather than letting it run into obscure errors.
Signed-off-by: Edgar E. Iglesias <edgar.iglesias at xilinx.com>
---
arch/arm/cpu/armv8/start.S | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/arch/arm/cpu/armv8/start.S b/arch/arm/cpu/armv8/start.S
index e5c2856cf5..39e1b842c4 100644
--- a/arch/arm/cpu/armv8/start.S
+++ b/arch/arm/cpu/armv8/start.S
@@ -101,6 +101,19 @@ pie_skip_reloc:
cmp x2, x3
b.lo pie_fix_loop
pie_fixup_done:
+#else
+ adr x0, _start
+ ldr x1, _TEXT_BASE
+ cmp x0, x1
+ beq 1f
+0:
+ /*
+ * FATAL, can't continue.
+ * U-Boot needs to start executing at CONFIG_SYS_TEXT_BASE.
+ */
+ wfi
+ b 0b
+1:
#endif
#ifdef CONFIG_SYS_RESET_SCTRL
--
2.25.1
More information about the U-Boot
mailing list