aboutsummaryrefslogtreecommitdiff
path: root/src/Compilation/Config.zig
diff options
context:
space:
mode:
authorAlex Rønne Petersen <alex@alexrp.com>2025-05-20 07:46:08 +0200
committerGitHub <noreply@github.com>2025-05-20 07:46:08 +0200
commitb27c5fbbdeeab12359c7f5bca0fe15fb0be9424e (patch)
tree50f2dd7a4811a047b4f99c81da04abe58fdcc86e /src/Compilation/Config.zig
parent23c817548bbd3988a5fd224b590a4f6102dbe5db (diff)
parentcd1eea09648f9ca6eeaf3882e1f74f90fe6c8ab3 (diff)
downloadzig-b27c5fbbdeeab12359c7f5bca0fe15fb0be9424e.tar.gz
zig-b27c5fbbdeeab12359c7f5bca0fe15fb0be9424e.zip
Merge pull request #23913 from alexrp/netbsd-libc
Support dynamically-linked NetBSD libc when cross-compiling
Diffstat (limited to 'src/Compilation/Config.zig')
-rw-r--r--src/Compilation/Config.zig6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/Compilation/Config.zig b/src/Compilation/Config.zig
index 493c63f34f..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 => {},
}
@@ -362,7 +363,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 +388,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;
}
}