zig

fork of https://codeberg.org/ziglang/zig
Log | Tree | Refs | README | LICENSE

commit 948bc91d12e147b46d54d82af5e9a9bc2ce25573 (tree)
parent c339aa655e58a3ecc22f21354b2d6584509a7dbe
Author: Alex Rønne Petersen <alex@alexrp.com>
Date:   Fri,  2 Aug 2024 09:52:19 +0200

std.Target.VersionRange: Make default() respect the minimum glibc version.

Diffstat:
Mlib/std/Target.zig | 16+++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/lib/std/Target.zig b/lib/std/Target.zig @@ -483,7 +483,21 @@ pub const Os = struct { .min = .{ .major = 4, .minor = 19, .patch = 0 }, .max = .{ .major = 6, .minor = 5, .patch = 7 }, }, - .glibc = .{ .major = 2, .minor = 28, .patch = 0 }, + .glibc = blk: { + const default_min = .{ .major = 2, .minor = 28, .patch = 0 }; + + for (std.zig.target.available_libcs) |libc| { + // We don't know the ABI here. We can get away with not checking it + // for now, but that may not always remain true. + if (libc.os != tag or libc.arch != arch) continue; + + if (libc.glibc_min) |min| { + if (min.order(default_min) == .gt) break :blk min; + } + } + + break :blk default_min; + }, }, },