From mboxrd@z Thu Jan 1 00:00:00 1970 From: Edgar E. Iglesias Date: Wed, 9 Sep 2020 19:07:27 +0200 Subject: [PATCH v3 4/4] arm64: Trap non-PIE builds early if starting from wrong address In-Reply-To: <20200909170727.658573-1-edgar.iglesias@gmail.com> References: <20200909170727.658573-1-edgar.iglesias@gmail.com> Message-ID: <20200909170727.658573-5-edgar.iglesias@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de From: "Edgar E. Iglesias" 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 --- 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