aboutsummaryrefslogtreecommitdiff
path: root/lib/std/coff.zig
diff options
context:
space:
mode:
Diffstat (limited to 'lib/std/coff.zig')
-rw-r--r--lib/std/coff.zig15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/std/coff.zig b/lib/std/coff.zig
index 2bf0b1c44e..a2da0552be 100644
--- a/lib/std/coff.zig
+++ b/lib/std/coff.zig
@@ -62,6 +62,21 @@ pub const MachineType = enum(u16) {
Thumb = 0x1c2,
/// MIPS little-endian WCE v2
WCEMIPSV2 = 0x169,
+
+ pub fn toTargetCpuArch(machine_type: MachineType) ?std.Target.Cpu.Arch {
+ return switch (machine_type) {
+ .ARM => .arm,
+ .POWERPC => .powerpc,
+ .RISCV32 => .riscv32,
+ .Thumb => .thumb,
+ .I386 => .i386,
+ .ARM64 => .aarch64,
+ .RISCV64 => .riscv64,
+ .X64 => .x86_64,
+ // there's cases we don't (yet) handle
+ else => null,
+ };
+ }
};
// OptionalHeader.magic values