| ... | @@ -86,50 +86,73 @@ pub fn targetTriple(allocator: Allocator, target: std.Target) ![:0]u8 { | ... | @@ -86,50 +86,73 @@ pub fn targetTriple(allocator: Allocator, target: std.Target) ![:0]u8 { |
| 86 | .spirv64 => return error.@"LLVM backend does not support SPIR-V", | 86 | .spirv64 => return error.@"LLVM backend does not support SPIR-V", |
| 87 | }; | 87 | }; |
| 88 | | 88 | |
| 89 | const llvm_os = switch (target.os.tag) { | 89 | const llvm_os = blk: { |
| 90 | .freestanding => "unknown", | 90 | if (target.os.tag.isDarwin()) { |
| 91 | .ananas => "ananas", | 91 | const min_version = target.os.version_range.semver.min; |
| 92 | .cloudabi => "cloudabi", | 92 | const llvm_os = switch (target.os.tag) { |
| 93 | .dragonfly => "dragonfly", | 93 | .macos => "macosx", |
| 94 | .freebsd => "freebsd", | 94 | .ios => "ios", |
| 95 | .fuchsia => "fuchsia", | 95 | .tvos => "tvos", |
| 96 | .ios => "ios", | 96 | .watchos => "watchos", |
| 97 | .kfreebsd => "kfreebsd", | 97 | else => unreachable, |
| 98 | .linux => "linux", | 98 | }; |
| 99 | .lv2 => "lv2", | 99 | break :blk try std.fmt.allocPrintZ(allocator, "{s}{d}.{d}.{d}", .{ |
| 100 | .macos => "macosx", | 100 | llvm_os, |
| 101 | .netbsd => "netbsd", | 101 | min_version.major, |
| 102 | .openbsd => "openbsd", | 102 | min_version.minor, |
| 103 | .solaris => "solaris", | 103 | min_version.patch, |
| 104 | .windows => "windows", | 104 | }); |
| 105 | .zos => "zos", | 105 | } |
| 106 | .haiku => "haiku", | 106 | |
| 107 | .minix => "minix", | 107 | const llvm_os = switch (target.os.tag) { |
| 108 | .rtems => "rtems", | 108 | .freestanding => "unknown", |
| 109 | .nacl => "nacl", | 109 | .ananas => "ananas", |
| 110 | .aix => "aix", | 110 | .cloudabi => "cloudabi", |
| 111 | .cuda => "cuda", | 111 | .dragonfly => "dragonfly", |
| 112 | .nvcl => "nvcl", | 112 | .freebsd => "freebsd", |
| 113 | .amdhsa => "amdhsa", | 113 | .fuchsia => "fuchsia", |
| 114 | .ps4 => "ps4", | 114 | .kfreebsd => "kfreebsd", |
| 115 | .elfiamcu => "elfiamcu", | 115 | .linux => "linux", |
| 116 | .tvos => "tvos", | 116 | .lv2 => "lv2", |
| 117 | .watchos => "watchos", | 117 | .netbsd => "netbsd", |
| 118 | .mesa3d => "mesa3d", | 118 | .openbsd => "openbsd", |
| 119 | .contiki => "contiki", | 119 | .solaris => "solaris", |
| 120 | .amdpal => "amdpal", | 120 | .windows => "windows", |
| 121 | .hermit => "hermit", | 121 | .zos => "zos", |
| 122 | .hurd => "hurd", | 122 | .haiku => "haiku", |
| 123 | .wasi => "wasi", | 123 | .minix => "minix", |
| 124 | .emscripten => "emscripten", | 124 | .rtems => "rtems", |
| 125 | .uefi => "windows", | 125 | .nacl => "nacl", |
| 126 | | 126 | .aix => "aix", |
| 127 | .opencl, | 127 | .cuda => "cuda", |
| 128 | .glsl450, | 128 | .nvcl => "nvcl", |
| 129 | .vulkan, | 129 | .amdhsa => "amdhsa", |
| 130 | .plan9, | 130 | .ps4 => "ps4", |
| 131 | .other, | 131 | .elfiamcu => "elfiamcu", |
| 132 | => "unknown", | 132 | .mesa3d => "mesa3d", |
| | 133 | .contiki => "contiki", |
| | 134 | .amdpal => "amdpal", |
| | 135 | .hermit => "hermit", |
| | 136 | .hurd => "hurd", |
| | 137 | .wasi => "wasi", |
| | 138 | .emscripten => "emscripten", |
| | 139 | .uefi => "windows", |
| | 140 | |
| | 141 | .opencl, |
| | 142 | .glsl450, |
| | 143 | .vulkan, |
| | 144 | .plan9, |
| | 145 | .other, |
| | 146 | => "unknown", |
| | 147 | |
| | 148 | .macos, |
| | 149 | .ios, |
| | 150 | .tvos, |
| | 151 | .watchos, |
| | 152 | => unreachable, |
| | 153 | }; |
| | 154 | |
| | 155 | break :blk llvm_os; |
| 133 | }; | 156 | }; |
| 134 | | 157 | |
| 135 | const llvm_abi = switch (target.abi) { | 158 | const llvm_abi = switch (target.abi) { |