authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-05-13 01:46:12+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-05-17 04:41:27+02:00
logd29ba75c848c6727fdbd796595a5356ef2aa2408
tree789a6d33a48a33ffef99f5288ba3938577ed0005
parent1a82cceb8c53cc5d4ef684798e0bccb9d220b86c
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

Compilation.Config: Default to dynamic linking with NetBSD libc.


1 files changed, 3 insertions(+), 2 deletions(-)

src/Compilation/Config.zig+3-2
...@@ -362,7 +362,8 @@ pub fn resolve(options: Options) ResolveError!Config {...@@ -362,7 +362,8 @@ pub fn resolve(options: Options) ResolveError!Config {
362 if (explicitly_exe_or_dyn_lib and link_libc and362 if (explicitly_exe_or_dyn_lib and link_libc and
363 (target_util.osRequiresLibC(target) or363 (target_util.osRequiresLibC(target) or
364 // For these libcs, Zig can only provide dynamic libc when cross-compiling.364 // For these libcs, Zig can only provide dynamic libc when cross-compiling.
365 ((target.isGnuLibC() or target.isFreeBSDLibC()) and !options.resolved_target.is_native_abi)))365 ((target.isGnuLibC() or target.isFreeBSDLibC() or target.isNetBSDLibC()) and
366 !options.resolved_target.is_native_abi)))
366 {367 {
367 if (options.link_mode == .static) return error.LibCRequiresDynamicLinking;368 if (options.link_mode == .static) return error.LibCRequiresDynamicLinking;
368 break :b .dynamic;369 break :b .dynamic;
...@@ -386,7 +387,7 @@ pub fn resolve(options: Options) ResolveError!Config {...@@ -386,7 +387,7 @@ pub fn resolve(options: Options) ResolveError!Config {
386 // When targeting systems where the kernel and libc are developed alongside each other,387 // When targeting systems where the kernel and libc are developed alongside each other,
387 // dynamic linking is the better default; static libc may contain code that requires388 // dynamic linking is the better default; static libc may contain code that requires
388 // the very latest kernel version.389 // the very latest kernel version.
389 if (target.isFreeBSDLibC()) {390 if (target.isFreeBSDLibC() or target.isNetBSDLibC()) {
390 break :b .dynamic;391 break :b .dynamic;
391 }392 }
392 }393 }