diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2024-08-07 01:14:54 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-07 01:14:54 -0700 |
| commit | cd5f673cae598decce04bc1d0e85775698ea48d9 (patch) | |
| tree | de34047700aa4bc727ce88aa5dd096eb3b8e14cf /lib/std/Target.zig | |
| parent | 8184912a9895523d23d03aa9bdcf607a56122a20 (diff) | |
| parent | f43c05690ed7f5a5f2db7dede06bba50016fa857 (diff) | |
| download | zig-cd5f673cae598decce04bc1d0e85775698ea48d9.tar.gz zig-cd5f673cae598decce04bc1d0e85775698ea48d9.zip | |
Merge pull request #20909 from alexrp/glibc-riscv
Support building glibc for riscv32/riscv64
Diffstat (limited to 'lib/std/Target.zig')
| -rw-r--r-- | lib/std/Target.zig | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/lib/std/Target.zig b/lib/std/Target.zig index 4d42ba674b..dc5da4a8ae 100644 --- 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; + }, }, }, @@ -1750,8 +1764,8 @@ pub const DynamicLinker = struct { else => "/lib64/ld-linux-x86-64.so.2", }), - .riscv32 => init("/lib/ld-linux-riscv32-ilp32.so.1"), - .riscv64 => init("/lib/ld-linux-riscv64-lp64.so.1"), + .riscv32 => init("/lib/ld-linux-riscv32-ilp32d.so.1"), + .riscv64 => init("/lib/ld-linux-riscv64-lp64d.so.1"), // Architectures in this list have been verified as not having a standard // dynamic linker path. |
