| author | |
| committer | |
| log | 27c85e5969f01853b2437d56ddc7a7eee9bf35d0 |
| tree | 695064b9ecba2fd19c90b5ab8e81db49cdf1d6ce |
| parent | f02d25d883cb5e9d9487e25ed9241c6c13bc1f88 |
| signature |
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().2 files changed, 3 insertions(+), 26 deletions(-)
lib/std/Target.zig-24| ... | ... | @@ -1939,30 +1939,6 @@ pub inline fn floatAbi(target: Target) FloatAbi { |
| 1939 | 1939 | return target.abi.floatAbi(); |
| 1940 | 1940 | } |
| 1941 | 1941 | |
| 1942 | pub inline fn hasDynamicLinker(target: Target) bool { | |
| 1943 | if (target.cpu.arch.isWasm()) { | |
| 1944 | return false; | |
| 1945 | } | |
| 1946 | switch (target.os.tag) { | |
| 1947 | .freestanding, | |
| 1948 | .ios, | |
| 1949 | .tvos, | |
| 1950 | .watchos, | |
| 1951 | .macos, | |
| 1952 | .visionos, | |
| 1953 | .uefi, | |
| 1954 | .windows, | |
| 1955 | .emscripten, | |
| 1956 | .opencl, | |
| 1957 | .opengl, | |
| 1958 | .vulkan, | |
| 1959 | .plan9, | |
| 1960 | .other, | |
| 1961 | => return false, | |
| 1962 | else => return true, | |
| 1963 | } | |
| 1964 | } | |
| 1965 | ||
| 1966 | 1942 | pub const DynamicLinker = struct { |
| 1967 | 1943 | /// Contains the memory used to store the dynamic linker path. This field |
| 1968 | 1944 | /// should not be used directly. See `get` and `set`. This field exists so |
lib/std/zig/system.zig+3-2| ... | ... | @@ -963,14 +963,15 @@ fn detectAbiAndDynamicLinker( |
| 963 | 963 | os: Target.Os, |
| 964 | 964 | query: Target.Query, |
| 965 | 965 | ) DetectError!Target { |
| 966 | const native_target_has_ld = comptime builtin.target.hasDynamicLinker(); | |
| 966 | const native_target_has_ld = comptime Target.DynamicLinker.kind(builtin.os.tag) != .none; | |
| 967 | 967 | const is_linux = builtin.target.os.tag == .linux; |
| 968 | 968 | const is_solarish = builtin.target.os.tag.isSolarish(); |
| 969 | const is_darwin = builtin.target.os.tag.isDarwin(); | |
| 969 | 970 | const have_all_info = query.dynamic_linker.get() != null and |
| 970 | 971 | query.abi != null and (!is_linux or query.abi.?.isGnu()); |
| 971 | 972 | const os_is_non_native = query.os_tag != null; |
| 972 | 973 | // The Solaris/illumos environment is always the same. |
| 973 | if (!native_target_has_ld or have_all_info or os_is_non_native or is_solarish) { | |
| 974 | if (!native_target_has_ld or have_all_info or os_is_non_native or is_solarish or is_darwin) { | |
| 974 | 975 | return defaultAbiAndDynamicLinker(cpu, os, query); |
| 975 | 976 | } |
| 976 | 977 | if (query.abi) |abi| { |