rpi: push fw_dtb_pointer in the .data section 59/219659/1
authorMatthias Brugger <mbrugger@suse.com>
Tue, 19 Nov 2019 15:01:02 +0000 (16:01 +0100)
committerJaehoon Chung <jh80.chung@samsung.com>
Mon, 9 Dec 2019 05:23:52 +0000 (14:23 +0900)
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:
board/raspberrypi/rpi/rpi.c:317:(.text.board_get_usable_ram_top+0x8):
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

Change-Id: I16e0ca281c9dc9871d5fb9af23ddfc29f57e8f63
Signed-off-by: Matthias Brugger <mbrugger@suse.com>
board/raspberrypi/rpi/lowlevel_init.S
board/raspberrypi/rpi/rpi.c

index 435eed5..8c39b3e 100644 (file)
@@ -6,15 +6,6 @@
 
 #include <config.h>
 
-.align 8
-.global fw_dtb_pointer
-fw_dtb_pointer:
-#ifdef CONFIG_ARM64
-       .dword 0x0
-#else
-       .word 0x0
-#endif
-
 /*
  * 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]
 #else
-       str     r2, fw_dtb_pointer
+       ldr     r8, =fw_dtb_pointer
+       str     r2, [r8]
 #endif
 
        /* Returns */
index 1b51ee9..2894209 100644 (file)
 
 DECLARE_GLOBAL_DATA_PTR;
 
-/* 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 {