mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH master] ARM64: lds: place relocation tables explicitly
@ 2026-08-31 10:03 Ahmad Fatoum
  2026-08-31 12:14 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2026-08-31 10:03 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

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@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




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-08-31 12:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-31 10:03 [PATCH master] ARM64: lds: place relocation tables explicitly Ahmad Fatoum
2026-08-31 12:14 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox