authorgravatar for xtex@astrafall.orgxtex <xtex@astrafall.org> 2026-08-18 10:32:55+08:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-08-18 09:03:05+02:00
log8e2d6e211bdf2d534281b7cee2dfdf88dc220910
tree5457432848b2e6d798a29ef7b005a17eb75a18b2
parentf73d7aa1821d6c7d71b89157afc045e04b10e96e

Elf2: fix default page alignment of LoongArch


1 files changed, 4 insertions(+), 1 deletions(-)

src/link/Elf2.zig+4-1
...@@ -4753,10 +4753,13 @@ fn ehdrType(elf: *const Elf) EhdrType {...@@ -4753,10 +4753,13 @@ fn ehdrType(elf: *const Elf) EhdrType {
4753fn targetPtrSize(elf: *const Elf) u8 {4753fn targetPtrSize(elf: *const Elf) u8 {
4754 return elf.identClass().size();4754 return elf.identClass().size();
4755}4755}
4756/// Page alignment for the target platform.
4757/// Usually this returns the maximum page size supported on the
4758/// target to maximize compatibility but there can be exceptions.
4756fn targetPageAlign(elf: *const Elf) std.mem.Alignment {4759fn targetPageAlign(elf: *const Elf) std.mem.Alignment {
4757 return .fromByteUnits(switch (elf.ehdrMachine()) {4760 return .fromByteUnits(switch (elf.ehdrMachine()) {
4758 .AARCH64 => 0x10000,4761 .AARCH64 => 0x10000,
4759 .LOONGARCH => 0x4000,4762 .LOONGARCH => 0x10000,
4760 .PPC64 => 0x10000,4763 .PPC64 => 0x10000,
4761 .RISCV => 0x1000,4764 .RISCV => 0x1000,
4762 .SPARCV9 => 0x100000,4765 .SPARCV9 => 0x100000,