authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-10-06 14:03:08+02:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2024-10-07 07:04:05+02:00
log7a2fde973d27c7c47dc6eba174c71ae93af29d5f
tree9848c0cc236bef3f894f0d5536451d1606cd1016
parent20e03beaef021b729279edd2063e30f9befb9f38

link.Elf: Fix page size calculation for more architectures.

Sourced from binutils/bfd.

1 files changed, 32 insertions(+), 2 deletions(-)

src/link/Elf.zig+32-2
......@@ -188,11 +188,41 @@ pub fn createEmpty(
188188 else => return error.UnsupportedELFArchitecture,
189189 };
190190
191 // This is the max page size that the target system can run with, aka the ABI page size. Not to
192 // be confused with the common page size, which is the page size that's used in practice on most
193 // systems.
191194 const page_size: u32 = switch (target.cpu.arch) {
192 .aarch64, .hexagon, .powerpc64le => 0x10000,
193 .sparc64 => 0x2000,
195 .bpfel,
196 .bpfeb,
197 .sparc64,
198 => 0x100000,
199 .aarch64,
200 .aarch64_be,
201 .amdgcn,
202 .hexagon,
203 .mips,
204 .mipsel,
205 .mips64,
206 .mips64el,
207 .powerpc,
208 .powerpcle,
209 .powerpc64,
210 .powerpc64le,
211 .sparc,
212 => 0x10000,
213 .loongarch32,
214 .loongarch64,
215 => 0x4000,
216 .arc,
217 .m68k,
218 => 0x2000,
219 .msp430,
220 => 0x4,
221 .avr,
222 => 0x1,
194223 else => 0x1000,
195224 };
225
196226 const is_dyn_lib = output_mode == .Lib and link_mode == .dynamic;
197227 const default_sym_version: elf.Elf64_Versym = if (is_dyn_lib or comp.config.rdynamic)
198228 elf.VER_NDX_GLOBAL