diff options
| author | Alex Rønne Petersen <alex@alexrp.com> | 2024-08-09 21:36:55 +0200 |
|---|---|---|
| committer | Alex Rønne Petersen <alex@alexrp.com> | 2024-08-15 10:55:46 +0200 |
| commit | 550438653d9d2b87edbd6f0d214b24d6fd03f706 (patch) | |
| tree | 89e30399bcd9ba7c88e0051cca62d14c3027ffe4 /src | |
| parent | b01c595d4a0c4a643a5a276b3c7624449b73b301 (diff) | |
| download | zig-550438653d9d2b87edbd6f0d214b24d6fd03f706.tar.gz zig-550438653d9d2b87edbd6f0d214b24d6fd03f706.zip | |
std.Target: Pull toCoffMachine()/toElfMachine() up from Arch to Target.
This enables them to give more correct results.
Contributes to #20771.
Diffstat (limited to 'src')
| -rw-r--r-- | src/link/Coff.zig | 2 | ||||
| -rw-r--r-- | src/link/Elf.zig | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/link/Coff.zig b/src/link/Coff.zig index 84fc4bb6ee..aaa9a9b5cd 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 = target.cpu.arch.toCoffMachine(), + .machine = target.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, diff --git a/src/link/Elf.zig b/src/link/Elf.zig index 103c69202b..140b8a6978 100644 --- a/src/link/Elf.zig +++ b/src/link/Elf.zig @@ -2831,7 +2831,7 @@ pub fn writeElfHeader(self: *Elf) !void { mem.writeInt(u16, hdr_buf[index..][0..2], @intFromEnum(elf_type), endian); index += 2; - const machine = target.cpu.arch.toElfMachine(); + const machine = target.toElfMachine(); mem.writeInt(u16, hdr_buf[index..][0..2], @intFromEnum(machine), endian); index += 2; |
