aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJakub Konka <kubkon@jakubkonka.com>2022-08-26 18:02:12 +0200
committerJakub Konka <kubkon@jakubkonka.com>2022-08-30 10:42:21 +0200
commited481e3837218659ab1c18d9d4b836cf656307b9 (patch)
tree42ab597577a4f5bde351ae72d356951e85db4781 /lib
parent90b3599c6846b29a6162a670783d6c2763683f36 (diff)
downloadzig-ed481e3837218659ab1c18d9d4b836cf656307b9.tar.gz
zig-ed481e3837218659ab1c18d9d4b836cf656307b9.zip
coff: write headers to file
Diffstat (limited to 'lib')
-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 1640d44fb5..08f8e7e8a3 100644
--- a/lib/std/coff.zig
+++ b/lib/std/coff.zig
@@ -787,6 +787,21 @@ pub const MachineType = enum(u16) {
/// MIPS little-endian WCE v2
WCEMIPSV2 = 0x169,
+ pub fn fromTargetCpuArch(arch: std.Target.Cpu.Arch) MachineType {
+ return switch (arch) {
+ .arm => .ARM,
+ .powerpc => .POWERPC,
+ .riscv32 => .RISCV32,
+ .thumb => .Thumb,
+ .i386 => .I386,
+ .aarch64 => .ARM64,
+ .riscv64 => .RISCV64,
+ .x86_64 => .X64,
+ // there's cases we don't (yet) handle
+ else => unreachable,
+ };
+ }
+
pub fn toTargetCpuArch(machine_type: MachineType) ?std.Target.Cpu.Arch {
return switch (machine_type) {
.ARM => .arm,