| ... | ... | @@ -760,52 +760,59 @@ pub const Abi = enum { |
| 760 | 760 | }; |
| 761 | 761 | |
| 762 | 762 | pub const ObjectFormat = enum { |
| 763 | | /// Common Object File Format (Windows) |
| 763 | /// C source code. |
| 764 | c, |
| 765 | /// The Common Object File Format used by Windows and UEFI. |
| 764 | 766 | coff, |
| 765 | | /// DirectX Container |
| 767 | /// The DirectX Container format containing either DXIL or DXBC. |
| 766 | 768 | dxcontainer, |
| 767 | | /// Executable and Linking Format |
| 769 | /// The Executable and Linkable Format used by many Unixes. |
| 768 | 770 | elf, |
| 769 | | /// macOS relocatables |
| 770 | | macho, |
| 771 | | /// Standard, Portable Intermediate Representation V |
| 772 | | spirv, |
| 773 | | /// WebAssembly |
| 774 | | wasm, |
| 775 | | /// C source code |
| 776 | | c, |
| 777 | | /// Intel IHEX |
| 771 | /// The Generalized Object File Format used by z/OS. |
| 772 | goff, |
| 773 | /// The Intel HEX format for storing binary code in ASCII text. |
| 778 | 774 | hex, |
| 775 | /// The Mach object format used by macOS and other Apple platforms. |
| 776 | macho, |
| 777 | /// Nvidia's PTX (Parallel Thread Execution) assembly language. |
| 778 | nvptx, |
| 779 | /// The a.out format used by Plan 9 from Bell Labs. |
| 780 | plan9, |
| 779 | 781 | /// Machine code with no metadata. |
| 780 | 782 | raw, |
| 781 | | /// Plan 9 from Bell Labs |
| 782 | | plan9, |
| 783 | | /// Nvidia PTX format |
| 784 | | nvptx, |
| 783 | /// The Khronos Group's Standard Portable Intermediate Representation V. |
| 784 | spirv, |
| 785 | /// The WebAssembly binary format. |
| 786 | wasm, |
| 787 | /// The eXtended Common Object File Format used by AIX. |
| 788 | xcoff, |
| 785 | 789 | |
| 786 | 790 | pub fn fileExt(of: ObjectFormat, arch: Cpu.Arch) [:0]const u8 { |
| 787 | 791 | return switch (of) { |
| 788 | | .coff => ".obj", |
| 789 | | .elf, .macho, .wasm => ".o", |
| 790 | 792 | .c => ".c", |
| 791 | | .spirv => ".spv", |
| 793 | .coff => ".obj", |
| 794 | .dxcontainer => ".dxil", |
| 795 | .elf, .goff, .macho, .wasm, .xcoff => ".o", |
| 792 | 796 | .hex => ".ihex", |
| 793 | | .raw => ".bin", |
| 794 | | .plan9 => arch.plan9Ext(), |
| 795 | 797 | .nvptx => ".ptx", |
| 796 | | .dxcontainer => ".dxil", |
| 798 | .plan9 => arch.plan9Ext(), |
| 799 | .raw => ".bin", |
| 800 | .spirv => ".spv", |
| 797 | 801 | }; |
| 798 | 802 | } |
| 799 | 803 | |
| 800 | 804 | pub fn default(os_tag: Os.Tag, arch: Cpu.Arch) ObjectFormat { |
| 801 | 805 | return switch (os_tag) { |
| 802 | | .windows, .uefi => .coff, |
| 803 | | .ios, .macos, .watchos, .tvos, .visionos => .macho, |
| 806 | .aix => .xcoff, |
| 807 | .driverkit, .ios, .macos, .tvos, .visionos, .watchos => .macho, |
| 804 | 808 | .plan9 => .plan9, |
| 809 | .uefi, .windows => .coff, |
| 810 | .zos => .goff, |
| 805 | 811 | else => switch (arch) { |
| 806 | | .wasm32, .wasm64 => .wasm, |
| 807 | | .spirv32, .spirv64 => .spirv, |
| 812 | .dxil => .dxcontainer, |
| 808 | 813 | .nvptx, .nvptx64 => .nvptx, |
| 814 | .spirv, .spirv32, .spirv64 => .spirv, |
| 815 | .wasm32, .wasm64 => .wasm, |
| 809 | 816 | else => .elf, |
| 810 | 817 | }, |
| 811 | 818 | }; |