Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

arm64: Remove redundant padding from linker script

Currently we place an ALIGN_DEBUG_RO between text and data for the .text
and .init sections, and depending on configuration each of these may
result in up to SECTION_SIZE bytes worth of padding (for
DEBUG_RODATA_ALIGN).

We make no distinction between the text and data in each of these
sections at any point when creating the initial page tables in head.S.
We also make no distinction when modifying the tables; __map_memblock,
fixup_executable, mark_rodata_ro, and fixup_init only work at section
granularity. Thus this padding is unnecessary.

For the spit between init text and data we impose a minimum alignment of
16 bytes, but this is also unnecessary. The init data is output
immediately after the padding before any symbols are defined, so this is
not required to keep a symbol for linker a section array correctly
associated with the data. Any objects within the section will be given
at least their usual alignment regardless.

This patch removes the redundant padding.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Jeremy Linton <jeremy.linton@arm.com>
Cc: Laura Abbott <labbott@fedoraproject.org>
Cc: Will Deacon <will.deacon@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>

authored by

Mark Rutland and committed by
Will Deacon
5b28cd9d e2c30ee3

-2
-2
arch/arm64/kernel/vmlinux.lds.S
··· 112 112 *(.got) /* Global offset table */ 113 113 } 114 114 115 - ALIGN_DEBUG_RO 116 115 RO_DATA(PAGE_SIZE) 117 116 EXCEPTION_TABLE(8) 118 117 NOTES ··· 126 127 ARM_EXIT_KEEP(EXIT_TEXT) 127 128 } 128 129 129 - ALIGN_DEBUG_RO_MIN(16) 130 130 .init.data : { 131 131 INIT_DATA 132 132 INIT_SETUP(16)