authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-02-23 21:28:26-08:00
committergravatar for david@vortan.devDavid Rubin <david@vortan.dev> 2025-02-25 11:22:33-08:00
log2447b87d98ee4b0fe13938c9b2acf2bb06cab572
tree8e5751e80a5a35795deb95ec3f76d0e6da48ee3f
parentfaf256e429914a816dd5ab1555671b7ee69ecc4e

std.heap.page_size_min: relax freestanding restriction

x86_64 and aarch64 have safe values for page_size_min

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

lib/std/heap.zig+5-5
......@@ -42,10 +42,8 @@ pub var next_mmap_addr_hint: ?[*]align(page_size_min) u8 = null;
4242///
4343/// On many systems, the actual page size can only be determined at runtime
4444/// with `pageSize`.
45pub const page_size_min: usize = std.options.page_size_min orelse (page_size_min_default orelse if (builtin.os.tag == .freestanding or builtin.os.tag == .other)
46 @compileError("freestanding/other page_size_min must provided with std.options.page_size_min")
47else
48 @compileError(@tagName(builtin.cpu.arch) ++ "-" ++ @tagName(builtin.os.tag) ++ " has unknown page_size_min; populate std.options.page_size_min"));
45pub const page_size_min: usize = std.options.page_size_min orelse page_size_min_default orelse
46 @compileError(@tagName(builtin.cpu.arch) ++ "-" ++ @tagName(builtin.os.tag) ++ " has unknown page_size_min; populate std.options.page_size_min");
4947
5048/// comptime-known maximum page size of the target.
5149///
......@@ -831,8 +829,10 @@ const page_size_min_default: ?usize = switch (builtin.os.tag) {
831829 .xtensa => 4 << 10,
832830 else => null,
833831 },
834 .freestanding => switch (builtin.cpu.arch) {
832 .freestanding, .other => switch (builtin.cpu.arch) {
835833 .wasm32, .wasm64 => 64 << 10,
834 .x86, .x86_64 => 4 << 10,
835 .aarch64, .aarch64_be => 4 << 10,
836836 else => null,
837837 },
838838 else => null,