| ... | @@ -697,57 +697,6 @@ pub const Os = struct { | ... | @@ -697,57 +697,6 @@ pub const Os = struct { |
| 697 | => |field| @field(os.version_range, @tagName(field)).isAtLeast(ver), | 697 | => |field| @field(os.version_range, @tagName(field)).isAtLeast(ver), |
| 698 | }; | 698 | }; |
| 699 | } | 699 | } |
| 700 | | | |
| 701 | /// On Darwin, we always link libSystem which contains libc. | | |
| 702 | /// Similarly on FreeBSD and NetBSD we always link system libc | | |
| 703 | /// since this is the stable syscall interface. | | |
| 704 | pub fn requiresLibC(os: Os) bool { | | |
| 705 | return switch (os.tag) { | | |
| 706 | .aix, | | |
| 707 | .driverkit, | | |
| 708 | .macos, | | |
| 709 | .ios, | | |
| 710 | .tvos, | | |
| 711 | .watchos, | | |
| 712 | .visionos, | | |
| 713 | .dragonfly, | | |
| 714 | .openbsd, | | |
| 715 | .haiku, | | |
| 716 | .solaris, | | |
| 717 | .illumos, | | |
| 718 | .serenity, | | |
| 719 | => true, | | |
| 720 | | | |
| 721 | .linux, | | |
| 722 | .windows, | | |
| 723 | .freebsd, | | |
| 724 | .netbsd, | | |
| 725 | .freestanding, | | |
| 726 | .fuchsia, | | |
| 727 | .ps3, | | |
| 728 | .zos, | | |
| 729 | .rtems, | | |
| 730 | .cuda, | | |
| 731 | .nvcl, | | |
| 732 | .amdhsa, | | |
| 733 | .ps4, | | |
| 734 | .ps5, | | |
| 735 | .mesa3d, | | |
| 736 | .contiki, | | |
| 737 | .amdpal, | | |
| 738 | .hermit, | | |
| 739 | .hurd, | | |
| 740 | .wasi, | | |
| 741 | .emscripten, | | |
| 742 | .uefi, | | |
| 743 | .opencl, | | |
| 744 | .opengl, | | |
| 745 | .vulkan, | | |
| 746 | .plan9, | | |
| 747 | .other, | | |
| 748 | => false, | | |
| 749 | }; | | |
| 750 | } | | |
| 751 | }; | 700 | }; |
| 752 | | 701 | |
| 753 | pub const aarch64 = @import("Target/aarch64.zig"); | 702 | pub const aarch64 = @import("Target/aarch64.zig"); |
| ... | @@ -2055,6 +2004,61 @@ pub inline fn isWasiLibC(target: *const Target) bool { | ... | @@ -2055,6 +2004,61 @@ pub inline fn isWasiLibC(target: *const Target) bool { |
| 2055 | return target.os.tag == .wasi and target.abi.isMusl(); | 2004 | return target.os.tag == .wasi and target.abi.isMusl(); |
| 2056 | } | 2005 | } |
| 2057 | | 2006 | |
| | 2007 | /// Does this target require linking libc? This may be the case if the target has an unstable |
| | 2008 | /// syscall interface, for example. |
| | 2009 | pub fn requiresLibC(target: *const Target) bool { |
| | 2010 | return switch (target.os.tag) { |
| | 2011 | .aix, |
| | 2012 | .driverkit, |
| | 2013 | .macos, |
| | 2014 | .ios, |
| | 2015 | .tvos, |
| | 2016 | .watchos, |
| | 2017 | .visionos, |
| | 2018 | .dragonfly, |
| | 2019 | .openbsd, |
| | 2020 | .haiku, |
| | 2021 | .solaris, |
| | 2022 | .illumos, |
| | 2023 | .serenity, |
| | 2024 | => true, |
| | 2025 | |
| | 2026 | // Android API levels prior to 29 did not have native TLS support. For these API levels, TLS |
| | 2027 | // is implemented through calls to `__emutls_get_address`. We provide this function in |
| | 2028 | // compiler-rt, but it's implemented by way of `pthread_key_create` et al, so linking libc |
| | 2029 | // is required. |
| | 2030 | .linux => target.abi.isAndroid() and target.os.version_range.linux.android < 29, |
| | 2031 | |
| | 2032 | .windows, |
| | 2033 | .freebsd, |
| | 2034 | .netbsd, |
| | 2035 | .freestanding, |
| | 2036 | .fuchsia, |
| | 2037 | .ps3, |
| | 2038 | .zos, |
| | 2039 | .rtems, |
| | 2040 | .cuda, |
| | 2041 | .nvcl, |
| | 2042 | .amdhsa, |
| | 2043 | .ps4, |
| | 2044 | .ps5, |
| | 2045 | .mesa3d, |
| | 2046 | .contiki, |
| | 2047 | .amdpal, |
| | 2048 | .hermit, |
| | 2049 | .hurd, |
| | 2050 | .wasi, |
| | 2051 | .emscripten, |
| | 2052 | .uefi, |
| | 2053 | .opencl, |
| | 2054 | .opengl, |
| | 2055 | .vulkan, |
| | 2056 | .plan9, |
| | 2057 | .other, |
| | 2058 | => false, |
| | 2059 | }; |
| | 2060 | } |
| | 2061 | |
| 2058 | pub const DynamicLinker = struct { | 2062 | pub const DynamicLinker = struct { |
| 2059 | /// Contains the memory used to store the dynamic linker path. This field | 2063 | /// Contains the memory used to store the dynamic linker path. This field |
| 2060 | /// should not be used directly. See `get` and `set`. This field exists so | 2064 | /// should not be used directly. See `get` and `set`. This field exists so |