[PATCH master] ARM64: lds: place relocation tables explicitly

Ahmad Fatoum a.fatoum at pengutronix.de
Mon Aug 31 03:03:32 PDT 2026


arch/arm/lib64/barebox.lds.S names PHDRS, but doesn't mention .rela.dyn,
.relr.dyn or .dynsym, so the linker places them as orphans.

With CONFIG_RELR disabled and a RELA table of several hundred KiB, GNU ld
squeezes it in-between .efi_runtime.text and .efi_runtime.data.
The latter, which starts its own PT_LOAD segment, ends then at an
unaligned address:

[15] .efi_runtime.text PROGBITS         00000000001e0000  001f0000
       0000000000002000  0000000000000000  AX       0     0     64
[16] .rela.dyn         RELA             00000000001e2000  001f2000
       00000000000abf30  0000000000000018   A       3     0     8
[17] .efi_runtime.data PROGBITS         000000000028df30  0029df30 <---
       0000000000000168  0000000000000000  WA       0     0     8

This will trigger a runtime panic when failing to apply the (page-wise)
memory protections.

A series for eliminating orphan sections completely is in the works.

For now, let's do the minimal fix of placing the tables via
BAREBOX_RELOCATION_TABLE like we already do for 32-bit ARM and
in the PBL linker script.

Fixes: 2aae71d068f6 ("ARM: lds: place EFI runtime code and data in separate PT_LOAD segments")
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 arch/arm/lib64/barebox.lds.S | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/lib64/barebox.lds.S b/arch/arm/lib64/barebox.lds.S
index a06a078d4142..40c25830cbb9 100644
--- a/arch/arm/lib64/barebox.lds.S
+++ b/arch/arm/lib64/barebox.lds.S
@@ -41,6 +41,8 @@ SECTIONS
 		RO_DATA_SECTION
 	} :rodata
 
+	BAREBOX_RELOCATION_TABLE
+
 	.dynamic : { *(.dynamic) } :rodata :dynamic
 
 	. = ALIGN(4096);
-- 
2.47.3




More information about the barebox mailing list