Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ardb+git@google.com>
To: linux-arm-kernel@lists.infradead.org
Cc: will@kernel.org, catalin.marinas@arm.com, mark.rutland@arm.com,
	 Ard Biesheuvel <ardb@kernel.org>
Subject: [PATCH 2/2] arm64/boot: Discard NULL relocation entries
Date: Mon, 23 Nov 2026 15:46:36 +0100	[thread overview]
Message-ID: <20261123144633.2725921-6-ardb+git@google.com> (raw)
In-Reply-To: <20261123144633.2725921-4-ardb+git@google.com>

From: Ard Biesheuvel <ardb@kernel.org>

The arm64 vmlinux image contains preliminary RELA entries for data
objects that are ultimately discarded by the linker:

  Relocation section '.rela.dyn' at offset 0x25a6c28 contains 27631 entries:
      Offset             Info             Type               Symbol's Value  Symbol's Name + Addend
  0000000000000000  0000000000000000 R_AARCH64_NONE                            0
  0000000000000000  0000000000000000 R_AARCH64_NONE                            0
  0000000000000000  0000000000000000 R_AARCH64_NONE                            0
  0000000000000000  0000000000000000 R_AARCH64_NONE                            0
  0000000000000000  0000000000000000 R_AARCH64_NONE                            0
  0000000000000000  0000000000000000 R_AARCH64_NONE                            0
  ...

These are all processed and ignored at boot when applying the KASLR
offset and take up ~650 KiB of .init data for no reason.

So discard the associated .rela sections explicitly.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
 arch/arm64/kernel/vmlinux.lds.S | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/kernel/vmlinux.lds.S b/arch/arm64/kernel/vmlinux.lds.S
index 1869b44ae190..55d5c4db8c26 100644
--- a/arch/arm64/kernel/vmlinux.lds.S
+++ b/arch/arm64/kernel/vmlinux.lds.S
@@ -183,6 +183,7 @@ SECTIONS
 	/DISCARD/ : {
 		*(.interp .dynamic)
 		*(.dynsym .dynstr .hash .gnu.hash)
+		*(.rela.discard.*) *(.rela.export_symbol)
 		*(.ARM.attributes)
 	}
 
-- 
2.56.1.750.gf70dc682cf-goog



      parent reply	other threads:[~2026-11-23 15:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23 14:46 [PATCH 0/2] arm64/boot: Some relocation tweaks Ard Biesheuvel
2026-11-23 14:46 ` [PATCH 1/2] arm64/boot: Handle RELR relocations more efficiently Ard Biesheuvel
2026-11-23 14:46 ` Ard Biesheuvel [this message]

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=20261123144633.2725921-6-ardb+git@google.com \
    --to=ardb+git@google.com \
    --cc=ardb@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    --cc=will@kernel.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