| ... | ... | @@ -1,9 +1,4 @@ |
| 1 | | const std = @import("std"); |
| 2 | | const builtin = @import("builtin"); |
| 3 | | const llvm = @import("llvm.zig"); |
| 4 | | const CInt = @import("c_int.zig").CInt; |
| 5 | | |
| 6 | | // TODO delete this file and use std.Target |
| 1 | // const builtin = @import("builtin"); |
| 7 | 2 | |
| 8 | 3 | pub const FloatAbi = enum { |
| 9 | 4 | Hard, |
| ... | ... | @@ -11,430 +6,161 @@ pub const FloatAbi = enum { |
| 11 | 6 | SoftFp, |
| 12 | 7 | }; |
| 13 | 8 | |
| 14 | | pub const Target = union(enum) { |
| 15 | | Native, |
| 16 | | Cross: Cross, |
| 17 | | |
| 18 | | pub const Cross = struct { |
| 19 | | arch: builtin.Arch, |
| 20 | | os: builtin.Os, |
| 21 | | abi: builtin.Abi, |
| 22 | | object_format: builtin.ObjectFormat, |
| 9 | // pub const Cross = struct { |
| 10 | // arch: Target.Arch, |
| 11 | // os: Target.Os, |
| 12 | // abi: Target.Abi, |
| 13 | // object_format: builtin.ObjectFormat, |
| 14 | // }; |
| 15 | |
| 16 | // pub fn getObjectFormat(self: Target) builtin.ObjectFormat { |
| 17 | // return switch (self) { |
| 18 | // .Native => builtin.object_format, |
| 19 | // .Cross => |t| t.object_format, |
| 20 | // }; |
| 21 | // } |
| 22 | |
| 23 | /// TODO expose the arch and subarch separately |
| 24 | pub fn isArmOrThumb(self: Target) bool { |
| 25 | return switch (self.getArch()) { |
| 26 | .arm, |
| 27 | .armeb, |
| 28 | .aarch64, |
| 29 | .aarch64_be, |
| 30 | .thumb, |
| 31 | .thumbeb, |
| 32 | => true, |
| 33 | else => false, |
| 23 | 34 | }; |
| 24 | | |
| 25 | | pub fn objFileExt(self: Target) []const u8 { |
| 26 | | return switch (self.getObjectFormat()) { |
| 27 | | builtin.ObjectFormat.coff => ".obj", |
| 28 | | else => ".o", |
| 29 | | }; |
| 30 | | } |
| 31 | | |
| 32 | | pub fn exeFileExt(self: Target) []const u8 { |
| 33 | | return switch (self.getOs()) { |
| 34 | | builtin.Os.windows => ".exe", |
| 35 | | else => "", |
| 36 | | }; |
| 37 | | } |
| 38 | | |
| 39 | | pub fn libFileExt(self: Target, is_static: bool) []const u8 { |
| 40 | | return switch (self.getOs()) { |
| 41 | | builtin.Os.windows => if (is_static) ".lib" else ".dll", |
| 42 | | else => if (is_static) ".a" else ".so", |
| 43 | | }; |
| 44 | | } |
| 45 | | |
| 46 | | pub fn getOs(self: Target) builtin.Os { |
| 47 | | return switch (self) { |
| 48 | | Target.Native => builtin.os, |
| 49 | | @TagType(Target).Cross => |t| t.os, |
| 50 | | }; |
| 51 | | } |
| 52 | | |
| 53 | | pub fn getArch(self: Target) builtin.Arch { |
| 54 | | switch (self) { |
| 55 | | Target.Native => return builtin.arch, |
| 56 | | @TagType(Target).Cross => |t| return t.arch, |
| 57 | | } |
| 58 | | } |
| 59 | | |
| 60 | | pub fn getAbi(self: Target) builtin.Abi { |
| 61 | | return switch (self) { |
| 62 | | Target.Native => builtin.abi, |
| 63 | | @TagType(Target).Cross => |t| t.abi, |
| 64 | | }; |
| 65 | | } |
| 66 | | |
| 67 | | pub fn getObjectFormat(self: Target) builtin.ObjectFormat { |
| 68 | | return switch (self) { |
| 69 | | Target.Native => builtin.object_format, |
| 70 | | @TagType(Target).Cross => |t| t.object_format, |
| 71 | | }; |
| 72 | | } |
| 73 | | |
| 74 | | pub fn isWasm(self: Target) bool { |
| 75 | | return switch (self.getArch()) { |
| 76 | | builtin.Arch.wasm32, builtin.Arch.wasm64 => true, |
| 77 | | else => false, |
| 78 | | }; |
| 79 | | } |
| 80 | | |
| 81 | | pub fn isDarwin(self: Target) bool { |
| 82 | | return switch (self.getOs()) { |
| 83 | | builtin.Os.ios, builtin.Os.macosx => true, |
| 84 | | else => false, |
| 85 | | }; |
| 86 | | } |
| 87 | | |
| 88 | | pub fn isWindows(self: Target) bool { |
| 89 | | return switch (self.getOs()) { |
| 90 | | builtin.Os.windows => true, |
| 91 | | else => false, |
| 92 | | }; |
| 93 | | } |
| 94 | | |
| 95 | | /// TODO expose the arch and subarch separately |
| 96 | | pub fn isArmOrThumb(self: Target) bool { |
| 97 | | return switch (self.getArch()) { |
| 98 | | builtin.Arch.arm, |
| 99 | | builtin.Arch.armeb, |
| 100 | | builtin.Arch.aarch64, |
| 101 | | builtin.Arch.aarch64_be, |
| 102 | | builtin.Arch.thumb, |
| 103 | | builtin.Arch.thumbeb, |
| 104 | | => true, |
| 105 | | else => false, |
| 106 | | }; |
| 107 | | } |
| 108 | | |
| 109 | | pub fn initializeAll() void { |
| 110 | | llvm.InitializeAllTargets(); |
| 111 | | llvm.InitializeAllTargetInfos(); |
| 112 | | llvm.InitializeAllTargetMCs(); |
| 113 | | llvm.InitializeAllAsmPrinters(); |
| 114 | | llvm.InitializeAllAsmParsers(); |
| 115 | | } |
| 116 | | |
| 117 | | pub fn getTriple(self: Target, allocator: *std.mem.Allocator) !std.Buffer { |
| 118 | | var result = try std.Buffer.initSize(allocator, 0); |
| 119 | | errdefer result.deinit(); |
| 120 | | |
| 121 | | // LLVM WebAssembly output support requires the target to be activated at |
| 122 | | // build type with -DCMAKE_LLVM_EXPIERMENTAL_TARGETS_TO_BUILD=WebAssembly. |
| 123 | | // |
| 124 | | // LLVM determines the output format based on the abi suffix, |
| 125 | | // defaulting to an object based on the architecture. The default format in |
| 126 | | // LLVM 6 sets the wasm arch output incorrectly to ELF. We need to |
| 127 | | // explicitly set this ourself in order for it to work. |
| 128 | | // |
| 129 | | // This is fixed in LLVM 7 and you will be able to get wasm output by |
| 130 | | // using the target triple `wasm32-unknown-unknown-unknown`. |
| 131 | | const env_name = if (self.isWasm()) "wasm" else @tagName(self.getAbi()); |
| 132 | | |
| 133 | | var out = &std.io.BufferOutStream.init(&result).stream; |
| 134 | | try out.print("{}-unknown-{}-{}", @tagName(self.getArch()), @tagName(self.getOs()), env_name); |
| 135 | | |
| 136 | | return result; |
| 137 | | } |
| 138 | | |
| 139 | | pub fn is64bit(self: Target) bool { |
| 140 | | return self.getArchPtrBitWidth() == 64; |
| 141 | | } |
| 142 | | |
| 143 | | pub fn getArchPtrBitWidth(self: Target) u32 { |
| 144 | | switch (self.getArch()) { |
| 145 | | builtin.Arch.avr, |
| 146 | | builtin.Arch.msp430, |
| 147 | | => return 16, |
| 148 | | |
| 149 | | builtin.Arch.arc, |
| 150 | | builtin.Arch.arm, |
| 151 | | builtin.Arch.armeb, |
| 152 | | builtin.Arch.hexagon, |
| 153 | | builtin.Arch.le32, |
| 154 | | builtin.Arch.mips, |
| 155 | | builtin.Arch.mipsel, |
| 156 | | builtin.Arch.powerpc, |
| 157 | | builtin.Arch.r600, |
| 158 | | builtin.Arch.riscv32, |
| 159 | | builtin.Arch.sparc, |
| 160 | | builtin.Arch.sparcel, |
| 161 | | builtin.Arch.tce, |
| 162 | | builtin.Arch.tcele, |
| 163 | | builtin.Arch.thumb, |
| 164 | | builtin.Arch.thumbeb, |
| 165 | | builtin.Arch.i386, |
| 166 | | builtin.Arch.xcore, |
| 167 | | builtin.Arch.nvptx, |
| 168 | | builtin.Arch.amdil, |
| 169 | | builtin.Arch.hsail, |
| 170 | | builtin.Arch.spir, |
| 171 | | builtin.Arch.kalimba, |
| 172 | | builtin.Arch.shave, |
| 173 | | builtin.Arch.lanai, |
| 174 | | builtin.Arch.wasm32, |
| 175 | | builtin.Arch.renderscript32, |
| 176 | | => return 32, |
| 177 | | |
| 178 | | builtin.Arch.aarch64, |
| 179 | | builtin.Arch.aarch64_be, |
| 180 | | builtin.Arch.mips64, |
| 181 | | builtin.Arch.mips64el, |
| 182 | | builtin.Arch.powerpc64, |
| 183 | | builtin.Arch.powerpc64le, |
| 184 | | builtin.Arch.riscv64, |
| 185 | | builtin.Arch.x86_64, |
| 186 | | builtin.Arch.nvptx64, |
| 187 | | builtin.Arch.le64, |
| 188 | | builtin.Arch.amdil64, |
| 189 | | builtin.Arch.hsail64, |
| 190 | | builtin.Arch.spir64, |
| 191 | | builtin.Arch.wasm64, |
| 192 | | builtin.Arch.renderscript64, |
| 193 | | builtin.Arch.amdgcn, |
| 194 | | builtin.Arch.bpfel, |
| 195 | | builtin.Arch.bpfeb, |
| 196 | | builtin.Arch.sparcv9, |
| 197 | | builtin.Arch.s390x, |
| 198 | | => return 64, |
| 199 | | } |
| 200 | | } |
| 201 | | |
| 202 | | pub fn getFloatAbi(self: Target) FloatAbi { |
| 203 | | return switch (self.getAbi()) { |
| 204 | | builtin.Abi.gnueabihf, |
| 205 | | builtin.Abi.eabihf, |
| 206 | | builtin.Abi.musleabihf, |
| 207 | | => FloatAbi.Hard, |
| 208 | | else => FloatAbi.Soft, |
| 209 | | }; |
| 210 | | } |
| 211 | | |
| 212 | | pub fn getDynamicLinkerPath(self: Target) ?[]const u8 { |
| 213 | | const env = self.getAbi(); |
| 214 | | const arch = self.getArch(); |
| 215 | | const os = self.getOs(); |
| 216 | | switch (os) { |
| 217 | | builtin.Os.freebsd => { |
| 218 | | return "/libexec/ld-elf.so.1"; |
| 219 | | }, |
| 220 | | builtin.Os.linux => { |
| 221 | | switch (env) { |
| 222 | | builtin.Abi.android => { |
| 223 | | if (self.is64bit()) { |
| 224 | | return "/system/bin/linker64"; |
| 225 | | } else { |
| 226 | | return "/system/bin/linker"; |
| 227 | | } |
| 228 | | }, |
| 229 | | builtin.Abi.gnux32 => { |
| 230 | | if (arch == builtin.Arch.x86_64) { |
| 231 | | return "/libx32/ld-linux-x32.so.2"; |
| 232 | | } |
| 233 | | }, |
| 234 | | builtin.Abi.musl, |
| 235 | | builtin.Abi.musleabi, |
| 236 | | builtin.Abi.musleabihf, |
| 237 | | => { |
| 238 | | if (arch == builtin.Arch.x86_64) { |
| 239 | | return "/lib/ld-musl-x86_64.so.1"; |
| 240 | | } |
| 241 | | }, |
| 242 | | else => {}, |
| 243 | | } |
| 244 | | switch (arch) { |
| 245 | | builtin.Arch.i386, |
| 246 | | builtin.Arch.sparc, |
| 247 | | builtin.Arch.sparcel, |
| 248 | | => return "/lib/ld-linux.so.2", |
| 249 | | |
| 250 | | builtin.Arch.aarch64 => return "/lib/ld-linux-aarch64.so.1", |
| 251 | | |
| 252 | | builtin.Arch.aarch64_be => return "/lib/ld-linux-aarch64_be.so.1", |
| 253 | | |
| 254 | | builtin.Arch.arm, |
| 255 | | builtin.Arch.thumb, |
| 256 | | => return switch (self.getFloatAbi()) { |
| 257 | | FloatAbi.Hard => return "/lib/ld-linux-armhf.so.3", |
| 258 | | else => return "/lib/ld-linux.so.3", |
| 259 | | }, |
| 260 | | |
| 261 | | builtin.Arch.armeb, |
| 262 | | builtin.Arch.thumbeb, |
| 263 | | => return switch (self.getFloatAbi()) { |
| 264 | | FloatAbi.Hard => return "/lib/ld-linux-armhf.so.3", |
| 265 | | else => return "/lib/ld-linux.so.3", |
| 266 | | }, |
| 267 | | |
| 268 | | builtin.Arch.mips, |
| 269 | | builtin.Arch.mipsel, |
| 270 | | builtin.Arch.mips64, |
| 271 | | builtin.Arch.mips64el, |
| 272 | | => return null, |
| 273 | | |
| 274 | | builtin.Arch.powerpc => return "/lib/ld.so.1", |
| 275 | | builtin.Arch.powerpc64 => return "/lib64/ld64.so.2", |
| 276 | | builtin.Arch.powerpc64le => return "/lib64/ld64.so.2", |
| 277 | | builtin.Arch.s390x => return "/lib64/ld64.so.1", |
| 278 | | builtin.Arch.sparcv9 => return "/lib64/ld-linux.so.2", |
| 279 | | builtin.Arch.x86_64 => return "/lib64/ld-linux-x86-64.so.2", |
| 280 | | |
| 281 | | builtin.Arch.arc, |
| 282 | | builtin.Arch.avr, |
| 283 | | builtin.Arch.bpfel, |
| 284 | | builtin.Arch.bpfeb, |
| 285 | | builtin.Arch.hexagon, |
| 286 | | builtin.Arch.msp430, |
| 287 | | builtin.Arch.r600, |
| 288 | | builtin.Arch.amdgcn, |
| 289 | | builtin.Arch.riscv32, |
| 290 | | builtin.Arch.riscv64, |
| 291 | | builtin.Arch.tce, |
| 292 | | builtin.Arch.tcele, |
| 293 | | builtin.Arch.xcore, |
| 294 | | builtin.Arch.nvptx, |
| 295 | | builtin.Arch.nvptx64, |
| 296 | | builtin.Arch.le32, |
| 297 | | builtin.Arch.le64, |
| 298 | | builtin.Arch.amdil, |
| 299 | | builtin.Arch.amdil64, |
| 300 | | builtin.Arch.hsail, |
| 301 | | builtin.Arch.hsail64, |
| 302 | | builtin.Arch.spir, |
| 303 | | builtin.Arch.spir64, |
| 304 | | builtin.Arch.kalimba, |
| 305 | | builtin.Arch.shave, |
| 306 | | builtin.Arch.lanai, |
| 307 | | builtin.Arch.wasm32, |
| 308 | | builtin.Arch.wasm64, |
| 309 | | builtin.Arch.renderscript32, |
| 310 | | builtin.Arch.renderscript64, |
| 311 | | => return null, |
| 312 | | } |
| 313 | | }, |
| 314 | | else => return null, |
| 315 | | } |
| 316 | | } |
| 317 | | |
| 318 | | pub fn llvmTargetFromTriple(triple: std.Buffer) !*llvm.Target { |
| 319 | | var result: *llvm.Target = undefined; |
| 320 | | var err_msg: [*]u8 = undefined; |
| 321 | | if (llvm.GetTargetFromTriple(triple.ptr(), &result, &err_msg) != 0) { |
| 322 | | std.debug.warn("triple: {s} error: {s}\n", triple.ptr(), err_msg); |
| 323 | | return error.UnsupportedTarget; |
| 324 | | } |
| 325 | | return result; |
| 326 | | } |
| 327 | | |
| 328 | | pub fn cIntTypeSizeInBits(self: Target, id: CInt.Id) u32 { |
| 329 | | const arch = self.getArch(); |
| 330 | | switch (self.getOs()) { |
| 331 | | builtin.Os.freestanding => switch (self.getArch()) { |
| 332 | | builtin.Arch.msp430 => switch (id) { |
| 333 | | CInt.Id.Short, |
| 334 | | CInt.Id.UShort, |
| 335 | | CInt.Id.Int, |
| 336 | | CInt.Id.UInt, |
| 337 | | => return 16, |
| 338 | | CInt.Id.Long, |
| 339 | | CInt.Id.ULong, |
| 340 | | => return 32, |
| 341 | | CInt.Id.LongLong, |
| 342 | | CInt.Id.ULongLong, |
| 343 | | => return 64, |
| 35 | } |
| 36 | |
| 37 | pub fn getFloatAbi(self: Target) FloatAbi { |
| 38 | return switch (self.getAbi()) { |
| 39 | .gnueabihf, |
| 40 | .eabihf, |
| 41 | .musleabihf, |
| 42 | => .Hard, |
| 43 | else => .Soft, |
| 44 | }; |
| 45 | } |
| 46 | |
| 47 | pub fn getDynamicLinkerPath(self: Target) ?[]const u8 { |
| 48 | const env = self.getAbi(); |
| 49 | const arch = self.getArch(); |
| 50 | const os = self.getOs(); |
| 51 | switch (os) { |
| 52 | .freebsd => { |
| 53 | return "/libexec/ld-elf.so.1"; |
| 54 | }, |
| 55 | .linux => { |
| 56 | switch (env) { |
| 57 | .android => { |
| 58 | if (is64bit(self)) { |
| 59 | return "/system/bin/linker64"; |
| 60 | } else { |
| 61 | return "/system/bin/linker"; |
| 62 | } |
| 344 | 63 | }, |
| 345 | | else => switch (id) { |
| 346 | | CInt.Id.Short, |
| 347 | | CInt.Id.UShort, |
| 348 | | => return 16, |
| 349 | | CInt.Id.Int, |
| 350 | | CInt.Id.UInt, |
| 351 | | => return 32, |
| 352 | | CInt.Id.Long, |
| 353 | | CInt.Id.ULong, |
| 354 | | => return self.getArchPtrBitWidth(), |
| 355 | | CInt.Id.LongLong, |
| 356 | | CInt.Id.ULongLong, |
| 357 | | => return 64, |
| 64 | .gnux32 => { |
| 65 | if (arch == .x86_64) { |
| 66 | return "/libx32/ld-linux-x32.so.2"; |
| 67 | } |
| 68 | }, |
| 69 | .musl, |
| 70 | .musleabi, |
| 71 | .musleabihf, |
| 72 | => { |
| 73 | if (arch == .x86_64) { |
| 74 | return "/lib/ld-musl-x86_64.so.1"; |
| 75 | } |
| 76 | }, |
| 77 | else => {}, |
| 78 | } |
| 79 | switch (arch) { |
| 80 | .i386, |
| 81 | .sparc, |
| 82 | .sparcel, |
| 83 | => return "/lib/ld-linux.so.2", |
| 84 | |
| 85 | .aarch64 => return "/lib/ld-linux-aarch64.so.1", |
| 86 | |
| 87 | .aarch64_be => return "/lib/ld-linux-aarch64_be.so.1", |
| 88 | |
| 89 | .arm, |
| 90 | .thumb, |
| 91 | => return switch (getFloatAbi(self)) { |
| 92 | .Hard => return "/lib/ld-linux-armhf.so.3", |
| 93 | else => return "/lib/ld-linux.so.3", |
| 358 | 94 | }, |
| 359 | | }, |
| 360 | | |
| 361 | | builtin.Os.linux, |
| 362 | | builtin.Os.macosx, |
| 363 | | builtin.Os.freebsd, |
| 364 | | builtin.Os.openbsd, |
| 365 | | builtin.Os.zen, |
| 366 | | => switch (id) { |
| 367 | | CInt.Id.Short, |
| 368 | | CInt.Id.UShort, |
| 369 | | => return 16, |
| 370 | | CInt.Id.Int, |
| 371 | | CInt.Id.UInt, |
| 372 | | => return 32, |
| 373 | | CInt.Id.Long, |
| 374 | | CInt.Id.ULong, |
| 375 | | => return self.getArchPtrBitWidth(), |
| 376 | | CInt.Id.LongLong, |
| 377 | | CInt.Id.ULongLong, |
| 378 | | => return 64, |
| 379 | | }, |
| 380 | | |
| 381 | | builtin.Os.windows, builtin.Os.uefi => switch (id) { |
| 382 | | CInt.Id.Short, |
| 383 | | CInt.Id.UShort, |
| 384 | | => return 16, |
| 385 | | CInt.Id.Int, |
| 386 | | CInt.Id.UInt, |
| 387 | | => return 32, |
| 388 | | CInt.Id.Long, |
| 389 | | CInt.Id.ULong, |
| 390 | | CInt.Id.LongLong, |
| 391 | | CInt.Id.ULongLong, |
| 392 | | => return 64, |
| 393 | | }, |
| 394 | 95 | |
| 395 | | builtin.Os.ananas, |
| 396 | | builtin.Os.cloudabi, |
| 397 | | builtin.Os.dragonfly, |
| 398 | | builtin.Os.fuchsia, |
| 399 | | builtin.Os.ios, |
| 400 | | builtin.Os.kfreebsd, |
| 401 | | builtin.Os.lv2, |
| 402 | | builtin.Os.netbsd, |
| 403 | | builtin.Os.solaris, |
| 404 | | builtin.Os.haiku, |
| 405 | | builtin.Os.minix, |
| 406 | | builtin.Os.rtems, |
| 407 | | builtin.Os.nacl, |
| 408 | | builtin.Os.cnk, |
| 409 | | builtin.Os.aix, |
| 410 | | builtin.Os.cuda, |
| 411 | | builtin.Os.nvcl, |
| 412 | | builtin.Os.amdhsa, |
| 413 | | builtin.Os.ps4, |
| 414 | | builtin.Os.elfiamcu, |
| 415 | | builtin.Os.tvos, |
| 416 | | builtin.Os.watchos, |
| 417 | | builtin.Os.mesa3d, |
| 418 | | builtin.Os.contiki, |
| 419 | | builtin.Os.amdpal, |
| 420 | | builtin.Os.hermit, |
| 421 | | builtin.Os.hurd, |
| 422 | | builtin.Os.wasi, |
| 423 | | => @panic("TODO specify the C integer type sizes for this OS"), |
| 424 | | } |
| 425 | | } |
| 96 | .armeb, |
| 97 | .thumbeb, |
| 98 | => return switch (getFloatAbi(self)) { |
| 99 | .Hard => return "/lib/ld-linux-armhf.so.3", |
| 100 | else => return "/lib/ld-linux.so.3", |
| 101 | }, |
| 426 | 102 | |
| 427 | | pub fn getDarwinArchString(self: Target) []const u8 { |
| 428 | | const arch = self.getArch(); |
| 429 | | switch (arch) { |
| 430 | | builtin.Arch.aarch64 => return "arm64", |
| 431 | | builtin.Arch.thumb, |
| 432 | | builtin.Arch.arm, |
| 433 | | => return "arm", |
| 434 | | builtin.Arch.powerpc => return "ppc", |
| 435 | | builtin.Arch.powerpc64 => return "ppc64", |
| 436 | | builtin.Arch.powerpc64le => return "ppc64le", |
| 437 | | else => return @tagName(arch), |
| 438 | | } |
| 439 | | } |
| 440 | | }; |
| 103 | .mips, |
| 104 | .mipsel, |
| 105 | .mips64, |
| 106 | .mips64el, |
| 107 | => return null, |
| 108 | |
| 109 | .powerpc => return "/lib/ld.so.1", |
| 110 | .powerpc64 => return "/lib64/ld64.so.2", |
| 111 | .powerpc64le => return "/lib64/ld64.so.2", |
| 112 | .s390x => return "/lib64/ld64.so.1", |
| 113 | .sparcv9 => return "/lib64/ld-linux.so.2", |
| 114 | .x86_64 => return "/lib64/ld-linux-x86-64.so.2", |
| 115 | |
| 116 | .arc, |
| 117 | .avr, |
| 118 | .bpfel, |
| 119 | .bpfeb, |
| 120 | .hexagon, |
| 121 | .msp430, |
| 122 | .r600, |
| 123 | .amdgcn, |
| 124 | .riscv32, |
| 125 | .riscv64, |
| 126 | .tce, |
| 127 | .tcele, |
| 128 | .xcore, |
| 129 | .nvptx, |
| 130 | .nvptx64, |
| 131 | .le32, |
| 132 | .le64, |
| 133 | .amdil, |
| 134 | .amdil64, |
| 135 | .hsail, |
| 136 | .hsail64, |
| 137 | .spir, |
| 138 | .spir64, |
| 139 | .kalimba, |
| 140 | .shave, |
| 141 | .lanai, |
| 142 | .wasm32, |
| 143 | .wasm64, |
| 144 | .renderscript32, |
| 145 | .renderscript64, |
| 146 | .aarch64_32, |
| 147 | => return null, |
| 148 | } |
| 149 | }, |
| 150 | else => return null, |
| 151 | } |
| 152 | } |
| 153 | |
| 154 | pub fn getDarwinArchString(self: Target) []const u8 { |
| 155 | const arch = self.getArch(); |
| 156 | switch (arch) { |
| 157 | .aarch64 => return "arm64", |
| 158 | .thumb, |
| 159 | .arm, |
| 160 | => return "arm", |
| 161 | .powerpc => return "ppc", |
| 162 | .powerpc64 => return "ppc64", |
| 163 | .powerpc64le => return "ppc64le", |
| 164 | else => return @tagName(arch), |
| 165 | } |
| 166 | } |