From 89ead8a57a0d2d0227d327e8e43ab221f852d4e9 Mon Sep 17 00:00:00 2001 From: Ivaylo Ivanov Date: Wed, 27 May 2026 16:07:59 +0000 Subject: [PATCH] arch: aarch64: align .{rodata,data,bss} to 8 bytes ALIGN(4) is left over from 32-bit linker script templates. On aarch64 the natural pointer/long alignment is 8, and these sections usually contain 64-bit constants (pointer tables, 64-bit literals). The 4-byte alignment was harmless because the linker happens to align individual symbols anyway, but let's just align it properly for the sake of correctness. For BSS also ensure we have extra padding before the end of the section. --- arch/aarch64/linker.lds.S | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/aarch64/linker.lds.S b/arch/aarch64/linker.lds.S index 79e29bf..30de9b0 100644 --- a/arch/aarch64/linker.lds.S +++ b/arch/aarch64/linker.lds.S @@ -50,21 +50,22 @@ SECTIONS } #endif - .rodata ALIGN(4) : { + .rodata ALIGN(8) : { *(.rodata) *(.rodata.*) } - .data ALIGN(4) : { + .data ALIGN(8) : { *(.data) *(.data.*) } - .bss ALIGN(4) : { + .bss ALIGN(8) : { __bss_start = .; *(.bss) *(.bss.*) *(COMMON) + . = ALIGN(8); __bss_end = .; }