mirror of
https://github.com/ziglang/zig.git
synced 2026-02-13 21:08:36 +00:00
std.Target: Remove hasDynamicLinker() in favor of DynamicLinker.kind().
hasDynamicLinker() was just kind of lying in the case of Darwin platforms for the benefit of std.zig.system.detectAbiAndDynamicLinker(). A better name would have been hasElfDynamicLinker() or something. It also got the answer wrong for a bunch of platforms that don't actually use ELF. Anyway, this was clearly the wrong layer to do this at, so remove this function and instead use DynamicLinker.kind() + an isDarwin() check in detectAbiAndDynamicLinker().
This commit is contained in:
parent
f02d25d883
commit
27c85e5969
@ -1939,30 +1939,6 @@ pub inline fn floatAbi(target: Target) FloatAbi {
|
||||
return target.abi.floatAbi();
|
||||
}
|
||||
|
||||
pub inline fn hasDynamicLinker(target: Target) bool {
|
||||
if (target.cpu.arch.isWasm()) {
|
||||
return false;
|
||||
}
|
||||
switch (target.os.tag) {
|
||||
.freestanding,
|
||||
.ios,
|
||||
.tvos,
|
||||
.watchos,
|
||||
.macos,
|
||||
.visionos,
|
||||
.uefi,
|
||||
.windows,
|
||||
.emscripten,
|
||||
.opencl,
|
||||
.opengl,
|
||||
.vulkan,
|
||||
.plan9,
|
||||
.other,
|
||||
=> return false,
|
||||
else => return true,
|
||||
}
|
||||
}
|
||||
|
||||
pub const DynamicLinker = struct {
|
||||
/// Contains the memory used to store the dynamic linker path. This field
|
||||
/// should not be used directly. See `get` and `set`. This field exists so
|
||||
|
||||
@ -963,14 +963,15 @@ fn detectAbiAndDynamicLinker(
|
||||
os: Target.Os,
|
||||
query: Target.Query,
|
||||
) DetectError!Target {
|
||||
const native_target_has_ld = comptime builtin.target.hasDynamicLinker();
|
||||
const native_target_has_ld = comptime Target.DynamicLinker.kind(builtin.os.tag) != .none;
|
||||
const is_linux = builtin.target.os.tag == .linux;
|
||||
const is_solarish = builtin.target.os.tag.isSolarish();
|
||||
const is_darwin = builtin.target.os.tag.isDarwin();
|
||||
const have_all_info = query.dynamic_linker.get() != null and
|
||||
query.abi != null and (!is_linux or query.abi.?.isGnu());
|
||||
const os_is_non_native = query.os_tag != null;
|
||||
// The Solaris/illumos environment is always the same.
|
||||
if (!native_target_has_ld or have_all_info or os_is_non_native or is_solarish) {
|
||||
if (!native_target_has_ld or have_all_info or os_is_non_native or is_solarish or is_darwin) {
|
||||
return defaultAbiAndDynamicLinker(cpu, os, query);
|
||||
}
|
||||
if (query.abi) |abi| {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user