diff options
| author | Alex Rønne Petersen <alex@alexrp.com> | 2024-10-06 14:03:08 +0200 |
|---|---|---|
| committer | Jakub Konka <kubkon@jakubkonka.com> | 2024-10-07 07:04:05 +0200 |
| commit | 7a2fde973d27c7c47dc6eba174c71ae93af29d5f (patch) | |
| tree | 9848c0cc236bef3f894f0d5536451d1606cd1016 /src | |
| parent | 20e03beaef021b729279edd2063e30f9befb9f38 (diff) | |
| download | zig-7a2fde973d27c7c47dc6eba174c71ae93af29d5f.tar.gz zig-7a2fde973d27c7c47dc6eba174c71ae93af29d5f.zip | |
link.Elf: Fix page size calculation for more architectures.
Sourced from binutils/bfd.
Diffstat (limited to 'src')
| -rw-r--r-- | src/link/Elf.zig | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/src/link/Elf.zig b/src/link/Elf.zig index a0ec37668e..f7b0529d8f 100644 --- a/src/link/Elf.zig +++ b/src/link/Elf.zig @@ -188,11 +188,41 @@ pub fn createEmpty( else => return error.UnsupportedELFArchitecture, }; + // This is the max page size that the target system can run with, aka the ABI page size. Not to + // be confused with the common page size, which is the page size that's used in practice on most + // systems. const page_size: u32 = switch (target.cpu.arch) { - .aarch64, .hexagon, .powerpc64le => 0x10000, - .sparc64 => 0x2000, + .bpfel, + .bpfeb, + .sparc64, + => 0x100000, + .aarch64, + .aarch64_be, + .amdgcn, + .hexagon, + .mips, + .mipsel, + .mips64, + .mips64el, + .powerpc, + .powerpcle, + .powerpc64, + .powerpc64le, + .sparc, + => 0x10000, + .loongarch32, + .loongarch64, + => 0x4000, + .arc, + .m68k, + => 0x2000, + .msp430, + => 0x4, + .avr, + => 0x1, else => 0x1000, }; + const is_dyn_lib = output_mode == .Lib and link_mode == .dynamic; const default_sym_version: elf.Elf64_Versym = if (is_dyn_lib or comp.config.rdynamic) elf.VER_NDX_GLOBAL |
