mirror of
https://github.com/ziglang/zig.git
synced 2026-02-13 04:48:20 +00:00
compiler: Allow linking native glibc statically.
This is generally ill-advised, but can be useful in some niche situations where the caveats don't apply. It might also be useful when providing a libc.txt that points to Eyra.
This commit is contained in:
parent
ae38575b42
commit
f6476e9cae
@ -352,7 +352,7 @@ pub fn resolve(options: Options) ResolveError!Config {
|
||||
break :b .static;
|
||||
}
|
||||
if (explicitly_exe_or_dyn_lib and link_libc and
|
||||
(target.isGnuLibC() or target_util.osRequiresLibC(target)))
|
||||
(target_util.osRequiresLibC(target) or (target.isGnuLibC() and !options.resolved_target.is_native_abi)))
|
||||
{
|
||||
if (options.link_mode == .static) return error.LibCRequiresDynamicLinking;
|
||||
break :b .dynamic;
|
||||
@ -367,11 +367,11 @@ pub fn resolve(options: Options) ResolveError!Config {
|
||||
|
||||
if (options.link_mode) |link_mode| break :b link_mode;
|
||||
|
||||
if (explicitly_exe_or_dyn_lib and link_libc and
|
||||
options.resolved_target.is_native_abi and target.abi.isMusl())
|
||||
if (explicitly_exe_or_dyn_lib and link_libc and options.resolved_target.is_native_abi and
|
||||
(target.isGnuLibC() or target.isMuslLibC()))
|
||||
{
|
||||
// If targeting the system's native ABI and the system's libc is
|
||||
// musl, link dynamically by default.
|
||||
// glibc or musl, link dynamically by default.
|
||||
break :b .dynamic;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user