From: "Pali Rohár" <pali@kernel.org>
To: Tom Rini <trini@konsulko.com>
Cc: u-boot@lists.denx.de, maemo-leste@lists.dyne.org
Subject: [PATCH 1/3] arm32: Fix relocation of env_addr if POSITION_INDEPENDENT=y
Date: Sun, 20 Nov 2022 17:56:26 +0100 [thread overview]
Message-ID: <20221120165628.14661-2-pali@kernel.org> (raw)
In-Reply-To: <20221120165628.14661-1-pali@kernel.org>
Apply commit 534f0fbd6520 ("arm64: Fix relocation of env_addr if
POSITION_INDEPENDENT=y") also for 32-bit ARM.
This change fixes crashing of U-Boot on ARMv7 (Omap3 / Cortex-A8) Nokia N900
phone (real HW). Note that qemu emulator of this board with same u-boot.bin
binary has not triggered this crash.
Crash happened after U-Boot printed following debug lines to serial console:
initcall: 0001ea8c (relocated to 8fe0aa8c)
Loading Environment from <NULL>... Using default environment
Destroy Hash Table: 8fe25a98 table = 00000000
Create Hash Table: N=387
Signed-off-by: Pali Rohár <pali@kernel.org>
---
arch/arm/lib/crt0.S | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/arch/arm/lib/crt0.S b/arch/arm/lib/crt0.S
index 6d566dca5c81..a0311438b458 100644
--- a/arch/arm/lib/crt0.S
+++ b/arch/arm/lib/crt0.S
@@ -147,6 +147,11 @@ ENTRY(_main)
ldr r1, =CONFIG_TEXT_BASE
sub r1, r0
add lr, r1
+#if defined(CONFIG_SYS_RELOC_GD_ENV_ADDR)
+ ldr r0, [r9, #GD_ENV_ADDR] /* r0 = gd->env_addr */
+ add r0, r0, r1
+ str r0, [r9, #GD_ENV_ADDR]
+#endif
#endif
ldr r0, [r9, #GD_RELOC_OFF] /* r0 = gd->reloc_off */
add lr, lr, r0
--
2.20.1
next prev parent reply other threads:[~2022-11-20 16:57 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-20 16:56 [PATCH 0/3] Nokia RX-51: Fixes for U-Boot v2023.01-rc1 Pali Rohár
2022-11-20 16:56 ` Pali Rohár [this message]
2022-11-20 16:59 ` [PATCH 1/3] arm32: Fix relocation of env_addr if POSITION_INDEPENDENT=y Fabio Estevam
2022-11-21 17:34 ` Tom Rini
2022-11-20 16:56 ` [PATCH 2/3] Nokia RX-51: Document debugging options and compile command Pali Rohár
2022-11-21 17:34 ` Tom Rini
2022-11-20 16:56 ` [PATCH 3/3] Nokia RX-51: Do not overwrite standard $loadaddr variable Pali Rohár
2022-11-21 17:34 ` Tom Rini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221120165628.14661-2-pali@kernel.org \
--to=pali@kernel.org \
--cc=maemo-leste@lists.dyne.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox