[PATCH 2/2] arm64/boot: Discard NULL relocation entries
Ard Biesheuvel
ardb+git at google.com
Mon Nov 23 06:46:36 PST 2026
From: Ard Biesheuvel <ardb at 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 at 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
More information about the linux-arm-kernel
mailing list