From 8e2d6e211bdf2d534281b7cee2dfdf88dc220910 Mon Sep 17 00:00:00 2001 From: xtex Date: Tue, 18 Aug 2026 10:32:55 +0800 Subject: [PATCH] Elf2: fix default page alignment of LoongArch --- src/link/Elf2.zig | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/link/Elf2.zig b/src/link/Elf2.zig index f8460dbf7362454171446aa0b93942e74f86972d..1400d0174815615d4f853ebb53ff2bc73dcd7915 100644 --- a/src/link/Elf2.zig +++ b/src/link/Elf2.zig @@ -4753,10 +4753,13 @@ fn ehdrType(elf: *const Elf) EhdrType { fn targetPtrSize(elf: *const Elf) u8 { return elf.identClass().size(); } +/// Page alignment for the target platform. +/// Usually this returns the maximum page size supported on the +/// target to maximize compatibility but there can be exceptions. fn targetPageAlign(elf: *const Elf) std.mem.Alignment { return .fromByteUnits(switch (elf.ehdrMachine()) { .AARCH64 => 0x10000, - .LOONGARCH => 0x4000, + .LOONGARCH => 0x10000, .PPC64 => 0x10000, .RISCV => 0x1000, .SPARCV9 => 0x100000, -- 2.54.0