The stack top is referenced from the entry point before relocation. Depending on the firmware, .rodata can get quite big and this position- independent relocation may lead to link errors: (.text_head_prologue_common+0x4): relocation truncated to fit: R_AARCH64_ADR_PREL_LO21 against symbol `__pbl_board_stack_top' One way to workaround this is using fw-external, but if barebox is running second stage anyway it is a hack having to use fw-external when there is no chainloading of barebox proper involved anyway. Let's avoid this linker error, by moving the stack top in front of .rodata instead of behind it. Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx> --- arch/arm/lib/pbl.lds.S | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm/lib/pbl.lds.S b/arch/arm/lib/pbl.lds.S index 4f58a4eba0c5..f097ac1fdd46 100644 --- a/arch/arm/lib/pbl.lds.S +++ b/arch/arm/lib/pbl.lds.S @@ -61,9 +61,6 @@ SECTIONS BAREBOX_BARE_INIT_SIZE BAREBOX_PBL_SIZE - . = ALIGN(4); - .rodata : { *(.rodata*) } - . = ALIGN(ASM_SZPTR); __pbl_board_stack_top = .; .rodata.pbl_board_stack_top : { @@ -73,6 +70,9 @@ SECTIONS } ASSERT(. - __pbl_board_stack_top <= 2 * ASM_SZPTR, "Only One PBL per Image allowed") + . = ALIGN(4); + .rodata : { *(.rodata*) } + .barebox_imd : { BAREBOX_IMD } . = ALIGN(PBL_SEGMENT_ALIGN); -- 2.39.5