From d29ba75c848c6727fdbd796595a5356ef2aa2408 Mon Sep 17 00:00:00 2001 From: Alex Rønne Petersen Date: Tue, 13 May 2025 01:46:12 +0200 Subject: Compilation.Config: Default to dynamic linking with NetBSD libc. --- src/Compilation/Config.zig | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/Compilation/Config.zig') diff --git a/src/Compilation/Config.zig b/src/Compilation/Config.zig index 493c63f34f..581f1eb624 100644 --- a/src/Compilation/Config.zig +++ b/src/Compilation/Config.zig @@ -362,7 +362,8 @@ pub fn resolve(options: Options) ResolveError!Config { if (explicitly_exe_or_dyn_lib and link_libc and (target_util.osRequiresLibC(target) or // For these libcs, Zig can only provide dynamic libc when cross-compiling. - ((target.isGnuLibC() or target.isFreeBSDLibC()) and !options.resolved_target.is_native_abi))) + ((target.isGnuLibC() or target.isFreeBSDLibC() or target.isNetBSDLibC()) and + !options.resolved_target.is_native_abi))) { if (options.link_mode == .static) return error.LibCRequiresDynamicLinking; break :b .dynamic; @@ -386,7 +387,7 @@ pub fn resolve(options: Options) ResolveError!Config { // When targeting systems where the kernel and libc are developed alongside each other, // dynamic linking is the better default; static libc may contain code that requires // the very latest kernel version. - if (target.isFreeBSDLibC()) { + if (target.isFreeBSDLibC() or target.isNetBSDLibC()) { break :b .dynamic; } } -- cgit v1.2.3 From c5e669ff768857df3cfab774318938ddfc254b90 Mon Sep 17 00:00:00 2001 From: Alex Rønne Petersen Date: Tue, 13 May 2025 01:46:37 +0200 Subject: compiler: Link libc by default when targeting NetBSD. We don't yet have a direct syscall layer in std.os.netbsd. --- src/Compilation/Config.zig | 1 + 1 file changed, 1 insertion(+) (limited to 'src/Compilation/Config.zig') diff --git a/src/Compilation/Config.zig b/src/Compilation/Config.zig index 581f1eb624..1251552086 100644 --- a/src/Compilation/Config.zig +++ b/src/Compilation/Config.zig @@ -339,6 +339,7 @@ pub fn resolve(options: Options) ResolveError!Config { // These targets don't require libc, but we don't yet have a syscall layer for them, // so we default to linking libc for now. .freebsd, + .netbsd, => break :b true, else => {}, } -- cgit v1.2.3