diff --git a/lib/std/coff.zig b/lib/std/coff.zig index bb7be2537d..818f980f6f 100644 --- a/lib/std/coff.zig +++ b/lib/std/coff.zig @@ -1061,23 +1061,6 @@ pub const MachineType = enum(u16) { _, - pub fn fromTargetCpuArch(arch: std.Target.Cpu.Arch) MachineType { - return switch (arch) { - .arm => .ARM, - .powerpc => .POWERPC, - .riscv32 => .RISCV32, - .thumb => .Thumb, - .x86 => .I386, - .aarch64 => .ARM64, - .riscv64 => .RISCV64, - .x86_64 => .X64, - .loongarch32 => .LOONGARCH32, - .loongarch64 => .LOONGARCH64, - // 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, diff --git a/src/link/Coff.zig b/src/link/Coff.zig index 73822dfec8..84fc4bb6ee 100644 --- a/src/link/Coff.zig +++ b/src/link/Coff.zig @@ -2259,7 +2259,7 @@ fn writeHeader(self: *Coff) !void { const timestamp = if (self.repro) 0 else std.time.timestamp(); const size_of_optional_header = @as(u16, @intCast(self.getOptionalHeaderSize() + self.getDataDirectoryHeadersSize())); var coff_header = coff.CoffHeader{ - .machine = coff.MachineType.fromTargetCpuArch(target.cpu.arch), + .machine = target.cpu.arch.toCoffMachine(), .number_of_sections = @as(u16, @intCast(self.sections.slice().len)), // TODO what if we prune a section .time_date_stamp = @as(u32, @truncate(@as(u64, @bitCast(timestamp)))), .pointer_to_symbol_table = self.strtab_offset orelse 0,