| ... | @@ -75,7 +75,13 @@ pub const Os = struct { | ... | @@ -75,7 +75,13 @@ pub const Os = struct { |
| 75 | | 75 | |
| 76 | pub inline fn isDarwin(tag: Tag) bool { | 76 | pub inline fn isDarwin(tag: Tag) bool { |
| 77 | return switch (tag) { | 77 | return switch (tag) { |
| 78 | .ios, .macos, .watchos, .tvos, .visionos => true, | 78 | .driverkit, |
| | 79 | .ios, |
| | 80 | .macos, |
| | 81 | .tvos, |
| | 82 | .visionos, |
| | 83 | .watchos, |
| | 84 | => true, |
| 79 | else => false, | 85 | else => false, |
| 80 | }; | 86 | }; |
| 81 | } | 87 | } |
| ... | @@ -116,7 +122,13 @@ pub const Os = struct { | ... | @@ -116,7 +122,13 @@ pub const Os = struct { |
| 116 | pub fn dynamicLibSuffix(tag: Tag) [:0]const u8 { | 122 | pub fn dynamicLibSuffix(tag: Tag) [:0]const u8 { |
| 117 | return switch (tag) { | 123 | return switch (tag) { |
| 118 | .windows, .uefi => ".dll", | 124 | .windows, .uefi => ".dll", |
| 119 | .ios, .macos, .watchos, .tvos, .visionos => ".dylib", | 125 | .driverkit, |
| | 126 | .ios, |
| | 127 | .macos, |
| | 128 | .tvos, |
| | 129 | .visionos, |
| | 130 | .watchos, |
| | 131 | => ".dylib", |
| 120 | else => ".so", | 132 | else => ".so", |
| 121 | }; | 133 | }; |
| 122 | } | 134 | } |
| ... | @@ -132,7 +144,7 @@ pub const Os = struct { | ... | @@ -132,7 +144,7 @@ pub const Os = struct { |
| 132 | } | 144 | } |
| 133 | | 145 | |
| 134 | pub inline fn isGnuLibC(tag: Os.Tag, abi: Abi) bool { | 146 | pub inline fn isGnuLibC(tag: Os.Tag, abi: Abi) bool { |
| 135 | return tag == .linux and abi.isGnu(); | 147 | return (tag == .hurd or tag == .linux) and abi.isGnu(); |
| 136 | } | 148 | } |
| 137 | | 149 | |
| 138 | pub fn defaultVersionRange(tag: Tag, arch: Cpu.Arch) Os { | 150 | pub fn defaultVersionRange(tag: Tag, arch: Cpu.Arch) Os { |
| ... | @@ -163,7 +175,6 @@ pub const Os = struct { | ... | @@ -163,7 +175,6 @@ pub const Os = struct { |
| 163 | .hermit, | 175 | .hermit, |
| 164 | .hurd, | 176 | .hurd, |
| 165 | .emscripten, | 177 | .emscripten, |
| 166 | .driverkit, | | |
| 167 | .shadermodel, | 178 | .shadermodel, |
| 168 | .uefi, | 179 | .uefi, |
| 169 | .opencl, // TODO: OpenCL versions | 180 | .opencl, // TODO: OpenCL versions |
| ... | @@ -175,6 +186,7 @@ pub const Os = struct { | ... | @@ -175,6 +186,7 @@ pub const Os = struct { |
| 175 | .other, | 186 | .other, |
| 176 | => .none, | 187 | => .none, |
| 177 | | 188 | |
| | 189 | .driverkit, |
| 178 | .freebsd, | 190 | .freebsd, |
| 179 | .macos, | 191 | .macos, |
| 180 | .ios, | 192 | .ios, |
| ... | @@ -392,7 +404,6 @@ pub const Os = struct { | ... | @@ -392,7 +404,6 @@ pub const Os = struct { |
| 392 | .hermit, | 404 | .hermit, |
| 393 | .hurd, | 405 | .hurd, |
| 394 | .emscripten, | 406 | .emscripten, |
| 395 | .driverkit, | | |
| 396 | .shadermodel, | 407 | .shadermodel, |
| 397 | .uefi, | 408 | .uefi, |
| 398 | .opencl, // TODO: OpenCL versions | 409 | .opencl, // TODO: OpenCL versions |
| ... | @@ -410,6 +421,12 @@ pub const Os = struct { | ... | @@ -410,6 +421,12 @@ pub const Os = struct { |
| 410 | .max = .{ .major = 14, .minor = 0, .patch = 0 }, | 421 | .max = .{ .major = 14, .minor = 0, .patch = 0 }, |
| 411 | }, | 422 | }, |
| 412 | }, | 423 | }, |
| | 424 | .driverkit => .{ |
| | 425 | .semver = .{ |
| | 426 | .min = .{ .major = 19, .minor = 0, .patch = 0 }, |
| | 427 | .max = .{ .major = 24, .minor = 0, .patch = 0 }, |
| | 428 | }, |
| | 429 | }, |
| 413 | .macos => switch (arch) { | 430 | .macos => switch (arch) { |
| 414 | .aarch64 => VersionRange{ | 431 | .aarch64 => VersionRange{ |
| 415 | .semver = .{ | 432 | .semver = .{ |
| ... | @@ -554,7 +571,9 @@ pub const Os = struct { | ... | @@ -554,7 +571,9 @@ pub const Os = struct { |
| 554 | pub fn requiresLibC(os: Os) bool { | 571 | pub fn requiresLibC(os: Os) bool { |
| 555 | return switch (os.tag) { | 572 | return switch (os.tag) { |
| 556 | .freebsd, | 573 | .freebsd, |
| | 574 | .aix, |
| 557 | .netbsd, | 575 | .netbsd, |
| | 576 | .driverkit, |
| 558 | .macos, | 577 | .macos, |
| 559 | .ios, | 578 | .ios, |
| 560 | .tvos, | 579 | .tvos, |
| ... | @@ -575,7 +594,6 @@ pub const Os = struct { | ... | @@ -575,7 +594,6 @@ pub const Os = struct { |
| 575 | .ps3, | 594 | .ps3, |
| 576 | .zos, | 595 | .zos, |
| 577 | .rtems, | 596 | .rtems, |
| 578 | .aix, | | |
| 579 | .cuda, | 597 | .cuda, |
| 580 | .nvcl, | 598 | .nvcl, |
| 581 | .amdhsa, | 599 | .amdhsa, |
| ... | @@ -589,7 +607,6 @@ pub const Os = struct { | ... | @@ -589,7 +607,6 @@ pub const Os = struct { |
| 589 | .hurd, | 607 | .hurd, |
| 590 | .wasi, | 608 | .wasi, |
| 591 | .emscripten, | 609 | .emscripten, |
| 592 | .driverkit, | | |
| 593 | .shadermodel, | 610 | .shadermodel, |
| 594 | .uefi, | 611 | .uefi, |
| 595 | .opencl, | 612 | .opencl, |
| ... | @@ -818,6 +835,102 @@ pub const ObjectFormat = enum { | ... | @@ -818,6 +835,102 @@ pub const ObjectFormat = enum { |
| 818 | } | 835 | } |
| 819 | }; | 836 | }; |
| 820 | | 837 | |
| | 838 | pub fn toElfMachine(target: Target) std.elf.EM { |
| | 839 | if (target.os.tag == .elfiamcu) return .IAMCU; |
| | 840 | |
| | 841 | return switch (target.cpu.arch) { |
| | 842 | .amdgcn => .AMDGPU, |
| | 843 | .arc => .ARC_COMPACT2, |
| | 844 | .arm, .armeb, .thumb, .thumbeb => .ARM, |
| | 845 | .aarch64, .aarch64_be => .AARCH64, |
| | 846 | .avr => .AVR, |
| | 847 | .bpfel, .bpfeb => .BPF, |
| | 848 | .csky => .CSKY, |
| | 849 | .hexagon => .HEXAGON, |
| | 850 | .kalimba => .CSR_KALIMBA, |
| | 851 | .lanai => .LANAI, |
| | 852 | .loongarch32, .loongarch64 => .LOONGARCH, |
| | 853 | .m68k => .@"68K", |
| | 854 | .mips, .mips64, .mipsel, .mips64el => .MIPS, |
| | 855 | .msp430 => .MSP430, |
| | 856 | .powerpc, .powerpcle => .PPC, |
| | 857 | .powerpc64, .powerpc64le => .PPC64, |
| | 858 | .riscv32, .riscv64 => .RISCV, |
| | 859 | .s390x => .S390, |
| | 860 | .sparc => if (Target.sparc.featureSetHas(target.cpu.features, .v9)) .SPARC32PLUS else .SPARC, |
| | 861 | .sparc64 => .SPARCV9, |
| | 862 | .spu_2 => .SPU_2, |
| | 863 | .x86 => .@"386", |
| | 864 | .x86_64 => .X86_64, |
| | 865 | .xcore => .XCORE, |
| | 866 | .xtensa => .XTENSA, |
| | 867 | |
| | 868 | .dxil, |
| | 869 | .nvptx, |
| | 870 | .nvptx64, |
| | 871 | .spirv, |
| | 872 | .spirv32, |
| | 873 | .spirv64, |
| | 874 | .ve, |
| | 875 | .wasm32, |
| | 876 | .wasm64, |
| | 877 | => .NONE, |
| | 878 | }; |
| | 879 | } |
| | 880 | |
| | 881 | pub fn toCoffMachine(target: Target) std.coff.MachineType { |
| | 882 | return switch (target.cpu.arch) { |
| | 883 | .arm => .ARM, |
| | 884 | .thumb => .THUMB, |
| | 885 | .aarch64 => .ARM64, |
| | 886 | .loongarch32 => .LOONGARCH32, |
| | 887 | .loongarch64 => .LOONGARCH64, |
| | 888 | .riscv32 => .RISCV32, |
| | 889 | .riscv64 => .RISCV64, |
| | 890 | .x86 => .I386, |
| | 891 | .x86_64 => .X64, |
| | 892 | |
| | 893 | .amdgcn, |
| | 894 | .arc, |
| | 895 | .armeb, |
| | 896 | .thumbeb, |
| | 897 | .aarch64_be, |
| | 898 | .avr, |
| | 899 | .bpfel, |
| | 900 | .bpfeb, |
| | 901 | .csky, |
| | 902 | .dxil, |
| | 903 | .hexagon, |
| | 904 | .kalimba, |
| | 905 | .lanai, |
| | 906 | .m68k, |
| | 907 | .mips, |
| | 908 | .mipsel, |
| | 909 | .mips64, |
| | 910 | .mips64el, |
| | 911 | .msp430, |
| | 912 | .nvptx, |
| | 913 | .nvptx64, |
| | 914 | .powerpc, |
| | 915 | .powerpcle, |
| | 916 | .powerpc64, |
| | 917 | .powerpc64le, |
| | 918 | .s390x, |
| | 919 | .sparc, |
| | 920 | .sparc64, |
| | 921 | .spirv, |
| | 922 | .spirv32, |
| | 923 | .spirv64, |
| | 924 | .spu_2, |
| | 925 | .ve, |
| | 926 | .wasm32, |
| | 927 | .wasm64, |
| | 928 | .xcore, |
| | 929 | .xtensa, |
| | 930 | => .UNKNOWN, |
| | 931 | }; |
| | 932 | } |
| | 933 | |
| 821 | pub const SubSystem = enum { | 934 | pub const SubSystem = enum { |
| 822 | Console, | 935 | Console, |
| 823 | Windows, | 936 | Windows, |
| ... | @@ -1191,106 +1304,6 @@ pub const Cpu = struct { | ... | @@ -1191,106 +1304,6 @@ pub const Cpu = struct { |
| 1191 | return error.UnknownCpuModel; | 1304 | return error.UnknownCpuModel; |
| 1192 | } | 1305 | } |
| 1193 | | 1306 | |
| 1194 | pub fn toElfMachine(arch: Arch) std.elf.EM { | | |
| 1195 | return switch (arch) { | | |
| 1196 | .avr => .AVR, | | |
| 1197 | .msp430 => .MSP430, | | |
| 1198 | .arc => .ARC, | | |
| 1199 | .arm => .ARM, | | |
| 1200 | .armeb => .ARM, | | |
| 1201 | .hexagon => .HEXAGON, | | |
| 1202 | .dxil => .NONE, | | |
| 1203 | .m68k => .@"68K", | | |
| 1204 | .mips => .MIPS, | | |
| 1205 | .mipsel => .MIPS_RS3_LE, | | |
| 1206 | .powerpc, .powerpcle => .PPC, | | |
| 1207 | .riscv32 => .RISCV, | | |
| 1208 | .sparc => .SPARC, | | |
| 1209 | .thumb => .ARM, | | |
| 1210 | .thumbeb => .ARM, | | |
| 1211 | .x86 => .@"386", | | |
| 1212 | .xcore => .XCORE, | | |
| 1213 | .xtensa => .XTENSA, | | |
| 1214 | .nvptx => .NONE, | | |
| 1215 | .kalimba => .CSR_KALIMBA, | | |
| 1216 | .lanai => .LANAI, | | |
| 1217 | .wasm32 => .NONE, | | |
| 1218 | .aarch64 => .AARCH64, | | |
| 1219 | .aarch64_be => .AARCH64, | | |
| 1220 | .mips64 => .MIPS, | | |
| 1221 | .mips64el => .MIPS_RS3_LE, | | |
| 1222 | .powerpc64 => .PPC64, | | |
| 1223 | .powerpc64le => .PPC64, | | |
| 1224 | .riscv64 => .RISCV, | | |
| 1225 | .x86_64 => .X86_64, | | |
| 1226 | .nvptx64 => .NONE, | | |
| 1227 | .wasm64 => .NONE, | | |
| 1228 | .amdgcn => .AMDGPU, | | |
| 1229 | .bpfel => .BPF, | | |
| 1230 | .bpfeb => .BPF, | | |
| 1231 | .csky => .CSKY, | | |
| 1232 | .sparc64 => .SPARCV9, | | |
| 1233 | .s390x => .S390, | | |
| 1234 | .ve => .NONE, | | |
| 1235 | .spu_2 => .SPU_2, | | |
| 1236 | .spirv => .NONE, | | |
| 1237 | .spirv32 => .NONE, | | |
| 1238 | .spirv64 => .NONE, | | |
| 1239 | .loongarch32 => .LOONGARCH, | | |
| 1240 | .loongarch64 => .LOONGARCH, | | |
| 1241 | }; | | |
| 1242 | } | | |
| 1243 | | | |
| 1244 | pub fn toCoffMachine(arch: Arch) std.coff.MachineType { | | |
| 1245 | return switch (arch) { | | |
| 1246 | .avr => .Unknown, | | |
| 1247 | .msp430 => .Unknown, | | |
| 1248 | .arc => .Unknown, | | |
| 1249 | .arm => .ARM, | | |
| 1250 | .armeb => .Unknown, | | |
| 1251 | .dxil => .Unknown, | | |
| 1252 | .hexagon => .Unknown, | | |
| 1253 | .m68k => .Unknown, | | |
| 1254 | .mips => .Unknown, | | |
| 1255 | .mipsel => .Unknown, | | |
| 1256 | .powerpc, .powerpcle => .POWERPC, | | |
| 1257 | .riscv32 => .RISCV32, | | |
| 1258 | .sparc => .Unknown, | | |
| 1259 | .thumb => .Thumb, | | |
| 1260 | .thumbeb => .Thumb, | | |
| 1261 | .x86 => .I386, | | |
| 1262 | .xcore => .Unknown, | | |
| 1263 | .xtensa => .Unknown, | | |
| 1264 | .nvptx => .Unknown, | | |
| 1265 | .kalimba => .Unknown, | | |
| 1266 | .lanai => .Unknown, | | |
| 1267 | .wasm32 => .Unknown, | | |
| 1268 | .aarch64 => .ARM64, | | |
| 1269 | .aarch64_be => .ARM64, | | |
| 1270 | .mips64 => .Unknown, | | |
| 1271 | .mips64el => .Unknown, | | |
| 1272 | .powerpc64 => .Unknown, | | |
| 1273 | .powerpc64le => .Unknown, | | |
| 1274 | .riscv64 => .RISCV64, | | |
| 1275 | .x86_64 => .X64, | | |
| 1276 | .nvptx64 => .Unknown, | | |
| 1277 | .wasm64 => .Unknown, | | |
| 1278 | .amdgcn => .Unknown, | | |
| 1279 | .bpfel => .Unknown, | | |
| 1280 | .bpfeb => .Unknown, | | |
| 1281 | .csky => .Unknown, | | |
| 1282 | .sparc64 => .Unknown, | | |
| 1283 | .s390x => .Unknown, | | |
| 1284 | .ve => .Unknown, | | |
| 1285 | .spu_2 => .Unknown, | | |
| 1286 | .spirv => .Unknown, | | |
| 1287 | .spirv32 => .Unknown, | | |
| 1288 | .spirv64 => .Unknown, | | |
| 1289 | .loongarch32 => .LOONGARCH32, | | |
| 1290 | .loongarch64 => .LOONGARCH64, | | |
| 1291 | }; | | |
| 1292 | } | | |
| 1293 | | | |
| 1294 | pub fn endian(arch: Arch) std.builtin.Endian { | 1307 | pub fn endian(arch: Arch) std.builtin.Endian { |
| 1295 | return switch (arch) { | 1308 | return switch (arch) { |
| 1296 | .avr, | 1309 | .avr, |
| ... | @@ -1802,6 +1815,7 @@ pub const DynamicLinker = struct { | ... | @@ -1802,6 +1815,7 @@ pub const DynamicLinker = struct { |
| 1802 | => none, | 1815 | => none, |
| 1803 | }, | 1816 | }, |
| 1804 | | 1817 | |
| | 1818 | .driverkit, |
| 1805 | .ios, | 1819 | .ios, |
| 1806 | .tvos, | 1820 | .tvos, |
| 1807 | .watchos, | 1821 | .watchos, |
| ... | @@ -1846,7 +1860,6 @@ pub const DynamicLinker = struct { | ... | @@ -1846,7 +1860,6 @@ pub const DynamicLinker = struct { |
| 1846 | .amdpal, | 1860 | .amdpal, |
| 1847 | .hermit, | 1861 | .hermit, |
| 1848 | .hurd, | 1862 | .hurd, |
| 1849 | .driverkit, | | |
| 1850 | .shadermodel, | 1863 | .shadermodel, |
| 1851 | => none, | 1864 | => none, |
| 1852 | }; | 1865 | }; |
| ... | @@ -2261,7 +2274,13 @@ pub fn cTypeBitSize(target: Target, c_type: CType) u16 { | ... | @@ -2261,7 +2274,13 @@ pub fn cTypeBitSize(target: Target, c_type: CType) u16 { |
| 2261 | }, | 2274 | }, |
| 2262 | }, | 2275 | }, |
| 2263 | | 2276 | |
| 2264 | .macos, .ios, .tvos, .watchos, .visionos => switch (c_type) { | 2277 | .driverkit, |
| | 2278 | .ios, |
| | 2279 | .macos, |
| | 2280 | .tvos, |
| | 2281 | .visionos, |
| | 2282 | .watchos, |
| | 2283 | => switch (c_type) { |
| 2265 | .char => return 8, | 2284 | .char => return 8, |
| 2266 | .short, .ushort => return 16, | 2285 | .short, .ushort => return 16, |
| 2267 | .int, .uint, .float => return 32, | 2286 | .int, .uint, .float => return 32, |
| ... | @@ -2334,7 +2353,6 @@ pub fn cTypeBitSize(target: Target, c_type: CType) u16 { | ... | @@ -2334,7 +2353,6 @@ pub fn cTypeBitSize(target: Target, c_type: CType) u16 { |
| 2334 | .hermit, | 2353 | .hermit, |
| 2335 | .hurd, | 2354 | .hurd, |
| 2336 | .opengl, | 2355 | .opengl, |
| 2337 | .driverkit, | | |
| 2338 | .shadermodel, | 2356 | .shadermodel, |
| 2339 | => @panic("TODO specify the C integer and float type sizes for this OS"), | 2357 | => @panic("TODO specify the C integer and float type sizes for this OS"), |
| 2340 | } | 2358 | } |