[U-Boot,v4,1/4] rpi: push fw_dtb_pointer in the .data section
diff mbox series

Message ID 20191119150105.6515-2-matthias.bgg@kernel.org
State Accepted
Commit 37964494c03f0d23c58c0e43cd694df0733ec1ca
Delegated to: Matthias Brugger
Headers show
  • RPi one binary for RPi3/4 and RPi1/2
Related show

Commit Message

Matthias Brugger Nov. 19, 2019, 3:01 p.m. UTC
From: Matthias Brugger <mbrugger@suse.com>

The fw_dtb_pointer was defined in the assembly code, which makes him
live in section .text_rest
Put that's not necessary, we can push the variable in the .data section.

This will prevent relocation errors like:
relocation truncated to fit: R_AARCH64_LDST64_ABS_LO12_NC against symbol
`fw_dtb_pointer' defined in .text section in board/raspberrypi/rpi/built-in.o

Signed-off-by: Matthias Brugger <mbrugger@suse.com>


Changes in v4:
- use gcc attribute instead of random assignment

Changes in v3:
- fix armv7 build

Changes in v2:
- push fw_dtb_pointer into the .data section

 board/raspberrypi/rpi/lowlevel_init.S | 12 ++----------
 board/raspberrypi/rpi/rpi.c           |  7 +++++--
 2 files changed, 7 insertions(+), 12 deletions(-)

diff mbox series

diff --git a/board/raspberrypi/rpi/lowlevel_init.S b/board/raspberrypi/rpi/lowlevel_init.S
index 435eed521f..8c39b3e12e 100644
--- a/board/raspberrypi/rpi/lowlevel_init.S
+++ b/board/raspberrypi/rpi/lowlevel_init.S
@@ -6,15 +6,6 @@ 
 #include <config.h>
-.align 8
-.global fw_dtb_pointer
-#ifdef CONFIG_ARM64
-	.dword 0x0
-	.word 0x0
  * Routine: save_boot_params (called after reset from start.S)
  * Description: save ATAG/FDT address provided by the firmware at boot time
@@ -28,7 +19,8 @@  save_boot_params:
 	adr	x8, fw_dtb_pointer
 	str	x0, [x8]
-	str	r2, fw_dtb_pointer
+	ldr	r8, =fw_dtb_pointer
+	str	r2, [r8]
 	/* Returns */
diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c
index 9e0abdda31..e84a1db14a 100644
--- a/board/raspberrypi/rpi/rpi.c
+++ b/board/raspberrypi/rpi/rpi.c
@@ -27,8 +27,11 @@ 
-/* From lowlevel_init.S */
-extern unsigned long fw_dtb_pointer;
+/* Assigned in lowlevel_init.S
+ * Push the variable into the .data section so that it
+ * does not get cleared later.
+ */
+unsigned long __section(".data") fw_dtb_pointer;
 /* TODO(sjg@chromium.org): Move these to the msg.c file */
 struct msg_get_arm_mem {