From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH master] ARM64: lds: place relocation tables explicitly
Date: Mon, 31 Aug 2026 12:03:32 +0200 [thread overview]
Message-ID: <20260831100336.490064-1-a.fatoum@pengutronix.de> (raw)
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
next reply other threads:[~2026-08-31 10:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-31 10:03 Ahmad Fatoum [this message]
2026-08-31 12:14 ` Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260831100336.490064-1-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox