From a97e417ab1e555d14e6d76df722de92cca85ba2f Mon Sep 17 00:00:00 2001 From: Alex Rønne Petersen Date: Tue, 13 May 2025 01:49:45 +0200 Subject: compiler: Support building NetBSD crt1.o/Scrt1.o and stub shared libraries. Only works for NetBSD 10.1+. Note that we still default to targeting NetBSD 9. Contributes to #2877. --- src/link/Elf.zig | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/link/Elf.zig') diff --git a/src/link/Elf.zig b/src/link/Elf.zig index df91771ecf..af37655520 100644 --- a/src/link/Elf.zig +++ b/src/link/Elf.zig @@ -2070,6 +2070,13 @@ fn linkWithLLD(self: *Elf, arena: Allocator, tid: Zcu.PerThread.Id, prog_node: s }); try argv.append(lib_path); } + } else if (target.isNetBSDLibC()) { + for (netbsd.libs) |lib| { + const lib_path = try std.fmt.allocPrint(arena, "{}{c}lib{s}.so.{d}", .{ + comp.netbsd_so_files.?.dir_path, fs.path.sep, lib.name, lib.sover, + }); + try argv.append(lib_path); + } } else { diags.flags.missing_libc = true; } @@ -5289,6 +5296,7 @@ const gc = @import("Elf/gc.zig"); const glibc = @import("../libs/glibc.zig"); const musl = @import("../libs/musl.zig"); const freebsd = @import("../libs/freebsd.zig"); +const netbsd = @import("../libs/netbsd.zig"); const link = @import("../link.zig"); const relocatable = @import("Elf/relocatable.zig"); const relocation = @import("Elf/relocation.zig"); -- cgit v1.2.3