From: "Edgar E. Iglesias" <edgar.igles...@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.igles...@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

Reply via email to