mirror of
https://github.com/ziglang/zig.git
synced 2026-01-01 19:13:16 +00:00
std.coff: Remove MachineType.fromTargetCpuArch().
This does the same thing as std.Target.Cpu.Arch.toCoffMachine(). Just use that.
This commit is contained in:
parent
65affb1c22
commit
ac9ca7d30c
@ -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,
|
||||
|
||||
@ -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,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user