| ... | ... | @@ -835,6 +835,101 @@ pub const ObjectFormat = enum { |
| 835 | 835 | } |
| 836 | 836 | }; |
| 837 | 837 | |
| 838 | pub fn toElfMachine(target: Target) std.elf.EM { |
| 839 | // TODO: Return IAMCU for elfiamcu OS. |
| 840 | return switch (target.cpu.arch) { |
| 841 | .amdgcn => .AMDGPU, |
| 842 | .arc => .ARC_COMPACT2, |
| 843 | .arm, .armeb, .thumb, .thumbeb => .ARM, |
| 844 | .aarch64, .aarch64_be => .AARCH64, |
| 845 | .avr => .AVR, |
| 846 | .bpfel, .bpfeb => .BPF, |
| 847 | .csky => .CSKY, |
| 848 | .hexagon => .HEXAGON, |
| 849 | .kalimba => .CSR_KALIMBA, |
| 850 | .lanai => .LANAI, |
| 851 | .loongarch32, .loongarch64 => .LOONGARCH, |
| 852 | .m68k => .@"68K", |
| 853 | .mips, .mips64, .mipsel, .mips64el => .MIPS, |
| 854 | .msp430 => .MSP430, |
| 855 | .powerpc, .powerpcle => .PPC, |
| 856 | .powerpc64, .powerpc64le => .PPC64, |
| 857 | .riscv32, .riscv64 => .RISCV, |
| 858 | .s390x => .S390, |
| 859 | .sparc => .SPARC, // TODO: Should be SPARC32PLUS when targeting 32-bit v9. |
| 860 | .sparc64 => .SPARCV9, |
| 861 | .spu_2 => .SPU_2, |
| 862 | .x86 => .@"386", |
| 863 | .x86_64 => .X86_64, |
| 864 | .xcore => .XCORE, |
| 865 | .xtensa => .XTENSA, |
| 866 | |
| 867 | .dxil, |
| 868 | .nvptx, |
| 869 | .nvptx64, |
| 870 | .spirv, |
| 871 | .spirv32, |
| 872 | .spirv64, |
| 873 | .ve, |
| 874 | .wasm32, |
| 875 | .wasm64, |
| 876 | => .NONE, |
| 877 | }; |
| 878 | } |
| 879 | |
| 880 | pub fn toCoffMachine(target: Target) std.coff.MachineType { |
| 881 | return switch (target.cpu.arch) { |
| 882 | .arm => .ARM, |
| 883 | .thumb => .THUMB, |
| 884 | .aarch64 => .ARM64, |
| 885 | .loongarch32 => .LOONGARCH32, |
| 886 | .loongarch64 => .LOONGARCH64, |
| 887 | .riscv32 => .RISCV32, |
| 888 | .riscv64 => .RISCV64, |
| 889 | .x86 => .I386, |
| 890 | .x86_64 => .X64, |
| 891 | |
| 892 | .amdgcn, |
| 893 | .arc, |
| 894 | .armeb, |
| 895 | .thumbeb, |
| 896 | .aarch64_be, |
| 897 | .avr, |
| 898 | .bpfel, |
| 899 | .bpfeb, |
| 900 | .csky, |
| 901 | .dxil, |
| 902 | .hexagon, |
| 903 | .kalimba, |
| 904 | .lanai, |
| 905 | .m68k, |
| 906 | .mips, |
| 907 | .mipsel, |
| 908 | .mips64, |
| 909 | .mips64el, |
| 910 | .msp430, |
| 911 | .nvptx, |
| 912 | .nvptx64, |
| 913 | .powerpc, |
| 914 | .powerpcle, |
| 915 | .powerpc64, |
| 916 | .powerpc64le, |
| 917 | .s390x, |
| 918 | .sparc, |
| 919 | .sparc64, |
| 920 | .spirv, |
| 921 | .spirv32, |
| 922 | .spirv64, |
| 923 | .spu_2, |
| 924 | .ve, |
| 925 | .wasm32, |
| 926 | .wasm64, |
| 927 | .xcore, |
| 928 | .xtensa, |
| 929 | => .UNKNOWN, |
| 930 | }; |
| 931 | } |
| 932 | |
| 838 | 933 | pub const SubSystem = enum { |
| 839 | 934 | Console, |
| 840 | 935 | Windows, |
| ... | ... | @@ -1208,101 +1303,6 @@ pub const Cpu = struct { |
| 1208 | 1303 | return error.UnknownCpuModel; |
| 1209 | 1304 | } |
| 1210 | 1305 | |
| 1211 | | pub fn toElfMachine(arch: Arch) std.elf.EM { |
| 1212 | | // TODO: Return IAMCU for elfiamcu OS. |
| 1213 | | return switch (arch) { |
| 1214 | | .amdgcn => .AMDGPU, |
| 1215 | | .arc => .ARC_COMPACT2, |
| 1216 | | .arm, .armeb, .thumb, .thumbeb => .ARM, |
| 1217 | | .aarch64, .aarch64_be => .AARCH64, |
| 1218 | | .avr => .AVR, |
| 1219 | | .bpfel, .bpfeb => .BPF, |
| 1220 | | .csky => .CSKY, |
| 1221 | | .hexagon => .HEXAGON, |
| 1222 | | .kalimba => .CSR_KALIMBA, |
| 1223 | | .lanai => .LANAI, |
| 1224 | | .loongarch32, .loongarch64 => .LOONGARCH, |
| 1225 | | .m68k => .@"68K", |
| 1226 | | .mips, .mips64, .mipsel, .mips64el => .MIPS, |
| 1227 | | .msp430 => .MSP430, |
| 1228 | | .powerpc, .powerpcle => .PPC, |
| 1229 | | .powerpc64, .powerpc64le => .PPC64, |
| 1230 | | .riscv32, .riscv64 => .RISCV, |
| 1231 | | .s390x => .S390, |
| 1232 | | .sparc => .SPARC, // TODO: Should be SPARC32PLUS when targeting 32-bit v9. |
| 1233 | | .sparc64 => .SPARCV9, |
| 1234 | | .spu_2 => .SPU_2, |
| 1235 | | .x86 => .@"386", |
| 1236 | | .x86_64 => .X86_64, |
| 1237 | | .xcore => .XCORE, |
| 1238 | | .xtensa => .XTENSA, |
| 1239 | | |
| 1240 | | .dxil, |
| 1241 | | .nvptx, |
| 1242 | | .nvptx64, |
| 1243 | | .spirv, |
| 1244 | | .spirv32, |
| 1245 | | .spirv64, |
| 1246 | | .ve, |
| 1247 | | .wasm32, |
| 1248 | | .wasm64, |
| 1249 | | => .NONE, |
| 1250 | | }; |
| 1251 | | } |
| 1252 | | |
| 1253 | | pub fn toCoffMachine(arch: Arch) std.coff.MachineType { |
| 1254 | | return switch (arch) { |
| 1255 | | .arm => .ARM, |
| 1256 | | .thumb => .THUMB, |
| 1257 | | .aarch64 => .ARM64, |
| 1258 | | .loongarch32 => .LOONGARCH32, |
| 1259 | | .loongarch64 => .LOONGARCH64, |
| 1260 | | .riscv32 => .RISCV32, |
| 1261 | | .riscv64 => .RISCV64, |
| 1262 | | .x86 => .I386, |
| 1263 | | .x86_64 => .X64, |
| 1264 | | |
| 1265 | | .amdgcn, |
| 1266 | | .arc, |
| 1267 | | .armeb, |
| 1268 | | .thumbeb, |
| 1269 | | .aarch64_be, |
| 1270 | | .avr, |
| 1271 | | .bpfel, |
| 1272 | | .bpfeb, |
| 1273 | | .csky, |
| 1274 | | .dxil, |
| 1275 | | .hexagon, |
| 1276 | | .kalimba, |
| 1277 | | .lanai, |
| 1278 | | .m68k, |
| 1279 | | .mips, |
| 1280 | | .mipsel, |
| 1281 | | .mips64, |
| 1282 | | .mips64el, |
| 1283 | | .msp430, |
| 1284 | | .nvptx, |
| 1285 | | .nvptx64, |
| 1286 | | .powerpc, |
| 1287 | | .powerpcle, |
| 1288 | | .powerpc64, |
| 1289 | | .powerpc64le, |
| 1290 | | .s390x, |
| 1291 | | .sparc, |
| 1292 | | .sparc64, |
| 1293 | | .spirv, |
| 1294 | | .spirv32, |
| 1295 | | .spirv64, |
| 1296 | | .spu_2, |
| 1297 | | .ve, |
| 1298 | | .wasm32, |
| 1299 | | .wasm64, |
| 1300 | | .xcore, |
| 1301 | | .xtensa, |
| 1302 | | => .UNKNOWN, |
| 1303 | | }; |
| 1304 | | } |
| 1305 | | |
| 1306 | 1306 | pub fn endian(arch: Arch) std.builtin.Endian { |
| 1307 | 1307 | return switch (arch) { |
| 1308 | 1308 | .avr, |