authorgravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2026-08-02 14:32:26+01:00
committergravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2026-09-26 18:21:21+01:00
log0579c6a0254a00f5bb0d3cbef51ada1a1feaf500
tree25e219c2bee4412383a7002ee322640d88384fbc
parent1b7a78122ecf9d5f6d36b46c26bd5e3fb8211eea
signature Commit is signed but in an unrecognized format.

compiler: fix missed `Coff2` renames


5 files changed, 27 insertions(+), 29 deletions(-)

src/codegen.zig+1-1
...@@ -878,7 +878,7 @@ pub fn genNavRef(...@@ -878,7 +878,7 @@ pub fn genNavRef(
878 },878 },
879 .link_once => unreachable,879 .link_once => unreachable,
880 }880 }
881 } else if (lf.cast(.coff2)) |coff| {881 } else if (lf.cast(.coff)) |coff| {
882 return @fromBackingInt(@intCast(@backingInt(try coff.navSymbol(zcu, nav_index))));882 return @fromBackingInt(@intCast(@backingInt(try coff.navSymbol(zcu, nav_index))));
883 } else {883 } else {
884 std.debug.panic("TODO genNavRef for '{t}'", .{lf.tag});884 std.debug.panic("TODO genNavRef for '{t}'", .{lf.tag});
src/codegen/x86_64/Emit.zig+8-8
...@@ -142,7 +142,7 @@ pub fn emitMir(emit: *Emit) Error!void {...@@ -142,7 +142,7 @@ pub fn emitMir(emit: *Emit) Error!void {
142 else if (emit.bin_file.cast(.macho)) |macho_file|142 else if (emit.bin_file.cast(.macho)) |macho_file|
143 @fromBackingInt(@intCast(macho_file.getZigObject().?.getOrCreateMetadataForLazySymbol(macho_file, emit.pt, lazy_sym) catch |err|143 @fromBackingInt(@intCast(macho_file.getZigObject().?.getOrCreateMetadataForLazySymbol(macho_file, emit.pt, lazy_sym) catch |err|
144 return emit.fail("{s} creating lazy symbol", .{@errorName(err)})))144 return emit.fail("{s} creating lazy symbol", .{@errorName(err)})))
145 else if (emit.bin_file.cast(.coff2)) |coff|145 else if (emit.bin_file.cast(.coff)) |coff|
146 @fromBackingInt(@intCast(@backingInt(try coff.lazySymbol(lazy_sym))))146 @fromBackingInt(@intCast(@backingInt(try coff.lazySymbol(lazy_sym))))
147 else147 else
148 return emit.fail("lazy symbols unimplemented for {s}", .{@tagName(emit.bin_file.tag)}),148 return emit.fail("lazy symbols unimplemented for {s}", .{@tagName(emit.bin_file.tag)}),
...@@ -157,7 +157,7 @@ pub fn emitMir(emit: *Emit) Error!void {...@@ -157,7 +157,7 @@ pub fn emitMir(emit: *Emit) Error!void {
157 .type = .FUNC,157 .type = .FUNC,
158 }) else if (emit.bin_file.cast(.macho)) |macho_file|158 }) else if (emit.bin_file.cast(.macho)) |macho_file|
159 @fromBackingInt(@intCast(try macho_file.getGlobalSymbol(extern_func.toSlice(&emit.lower.mir).?, null)))159 @fromBackingInt(@intCast(try macho_file.getGlobalSymbol(extern_func.toSlice(&emit.lower.mir).?, null)))
160 else if (emit.bin_file.cast(.coff2)) |coff| @fromBackingInt(@intCast(@backingInt(try coff.globalSymbol(.{160 else if (emit.bin_file.cast(.coff)) |coff| @fromBackingInt(@intCast(@backingInt(try coff.globalSymbol(.{
161 .name = extern_func.toSlice(&emit.lower.mir).?,161 .name = extern_func.toSlice(&emit.lower.mir).?,
162 })))) else return emit.fail("external symbol unimplemented for {s}", .{@tagName(emit.bin_file.tag)}),162 })))) else return emit.fail("external symbol unimplemented for {s}", .{@tagName(emit.bin_file.tag)}),
163 .is_extern = true,163 .is_extern = true,
...@@ -171,7 +171,7 @@ pub fn emitMir(emit: *Emit) Error!void {...@@ -171,7 +171,7 @@ pub fn emitMir(emit: *Emit) Error!void {
171 switch (lowered_inst.encoding.mnemonic) {171 switch (lowered_inst.encoding.mnemonic) {
172 .call => {172 .call => {
173 reloc.target = .{ .branch = target };173 reloc.target = .{ .branch = target };
174 if (target.is_dll_import and emit.bin_file.cast(.coff2) != null) {174 if (target.is_dll_import and emit.bin_file.cast(.coff) != null) {
175 try emit.encodeInst(try .new(.none, .call, &.{175 try emit.encodeInst(try .new(.none, .call, &.{
176 .{ .mem = .initRip(.ptr, 0) },176 .{ .mem = .initRip(.ptr, 0) },
177 }, emit.lower.target), reloc_info);177 }, emit.lower.target), reloc_info);
...@@ -252,7 +252,7 @@ pub fn emitMir(emit: *Emit) Error!void {...@@ -252,7 +252,7 @@ pub fn emitMir(emit: *Emit) Error!void {
252 }, emit.lower.target), reloc_info),252 }, emit.lower.target), reloc_info),
253 else => unreachable,253 else => unreachable,
254 }254 }
255 } else if (emit.bin_file.cast(.coff2)) |_| {255 } else if (emit.bin_file.cast(.coff)) |_| {
256 if (target.is_dll_import) switch (lowered_inst.encoding.mnemonic) {256 if (target.is_dll_import) switch (lowered_inst.encoding.mnemonic) {
257 .lea => try emit.encodeInst(try .new(.none, .mov, &.{257 .lea => try emit.encodeInst(try .new(.none, .mov, &.{
258 lowered_inst.ops[0],258 lowered_inst.ops[0],
...@@ -372,7 +372,7 @@ pub fn emitMir(emit: *Emit) Error!void {...@@ -372,7 +372,7 @@ pub fn emitMir(emit: *Emit) Error!void {
372 }, emit.lower.target), &.{});372 }, emit.lower.target), &.{});
373 },373 },
374 else => unreachable,374 else => unreachable,
375 } else if (emit.bin_file.cast(.coff2)) |coff| {375 } else if (emit.bin_file.cast(.coff)) |coff| {
376 switch (emit.lower.target.cpu.arch) {376 switch (emit.lower.target.cpu.arch) {
377 else => unreachable,377 else => unreachable,
378 .x86 => {378 .x86 => {
...@@ -845,7 +845,7 @@ fn encodeInst(emit: *Emit, lowered_inst: Instruction, reloc_info: []const RelocI...@@ -845,7 +845,7 @@ fn encodeInst(emit: *Emit, lowered_inst: Instruction, reloc_info: []const RelocI
845 if (target.is_extern and !target.force_pcrel_direct) break :rt .GOTPCREL;845 if (target.is_extern and !target.force_pcrel_direct) break :rt .GOTPCREL;
846 break :rt .PC32;846 break :rt .PC32;
847 } },847 } },
848 ) else if (emit.bin_file.cast(.coff2)) |coff| try coff.addReloc(848 ) else if (emit.bin_file.cast(.coff)) |coff| try coff.addReloc(
849 @fromBackingInt(@intCast(@backingInt(emit.atom_id))),849 @fromBackingInt(@intCast(@backingInt(emit.atom_id))),
850 end_offset - 4,850 end_offset - 4,
851 @fromBackingInt(@intCast(@backingInt(target.symbol))),851 @fromBackingInt(@intCast(@backingInt(target.symbol))),
...@@ -883,7 +883,7 @@ fn encodeInst(emit: *Emit, lowered_inst: Instruction, reloc_info: []const RelocI...@@ -883,7 +883,7 @@ fn encodeInst(emit: *Emit, lowered_inst: Instruction, reloc_info: []const RelocI
883 .symbolnum = @intCast(@backingInt(target.symbol)),883 .symbolnum = @intCast(@backingInt(target.symbol)),
884 },884 },
885 });885 });
886 } else if (emit.bin_file.cast(.coff2)) |coff| try coff.addReloc(886 } else if (emit.bin_file.cast(.coff)) |coff| try coff.addReloc(
887 @fromBackingInt(@intCast(@backingInt(emit.atom_id))),887 @fromBackingInt(@intCast(@backingInt(emit.atom_id))),
888 end_offset - 4,888 end_offset - 4,
889 @fromBackingInt(@intCast(@backingInt(target.symbol))),889 @fromBackingInt(@intCast(@backingInt(target.symbol))),
...@@ -941,7 +941,7 @@ fn encodeInst(emit: *Emit, lowered_inst: Instruction, reloc_info: []const RelocI...@@ -941,7 +941,7 @@ fn encodeInst(emit: *Emit, lowered_inst: Instruction, reloc_info: []const RelocI
941 .symbolnum = @intCast(@backingInt(target.symbol)),941 .symbolnum = @intCast(@backingInt(target.symbol)),
942 },942 },
943 });943 });
944 } else if (emit.bin_file.cast(.coff2)) |coff| try coff.addReloc(944 } else if (emit.bin_file.cast(.coff)) |coff| try coff.addReloc(
945 @fromBackingInt(@intCast(@backingInt(emit.atom_id))),945 @fromBackingInt(@intCast(@backingInt(emit.atom_id))),
946 end_offset - 4,946 end_offset - 4,
947 @fromBackingInt(@intCast(@backingInt(target.symbol))),947 @fromBackingInt(@intCast(@backingInt(target.symbol))),
src/dev.zig+1-3
...@@ -109,7 +109,6 @@ pub const Env = enum {...@@ -109,7 +109,6 @@ pub const Env = enum {
109 .spork8_backend,109 .spork8_backend,
110 .lld_linker,110 .lld_linker,
111 .coff_linker,111 .coff_linker,
112 .coff2_linker,
113 .elf_linker,112 .elf_linker,
114 .elf2_linker,113 .elf2_linker,
115 .macho_linker,114 .macho_linker,
...@@ -231,7 +230,7 @@ pub const Env = enum {...@@ -231,7 +230,7 @@ pub const Env = enum {
231 .incremental,230 .incremental,
232 .legalize,231 .legalize,
233 .x86_64_backend,232 .x86_64_backend,
234 .coff2_linker,233 .coff_linker,
235 => true,234 => true,
236 else => Env.sema.supports(feature),235 else => Env.sema.supports(feature),
237 },236 },
...@@ -321,7 +320,6 @@ pub const Feature = enum {...@@ -321,7 +320,6 @@ pub const Feature = enum {
321320
322 lld_linker,321 lld_linker,
323 coff_linker,322 coff_linker,
324 coff2_linker,
325 elf_linker,323 elf_linker,
326 elf2_linker,324 elf2_linker,
327 macho_linker,325 macho_linker,
src/link.zig+16-16
...@@ -587,7 +587,7 @@ pub const File = struct {...@@ -587,7 +587,7 @@ pub const File = struct {
587 pub fn startProgress(base: *File, prog_node: std.Progress.Node) void {587 pub fn startProgress(base: *File, prog_node: std.Progress.Node) void {
588 switch (base.tag) {588 switch (base.tag) {
589 else => {},589 else => {},
590 inline .elf2, .coff2 => |tag| {590 inline .elf2, .coff => |tag| {
591 dev.check(tag.devFeature());591 dev.check(tag.devFeature());
592 return @as(*tag.Type(), @fieldParentPtr("base", base)).startProgress(prog_node);592 return @as(*tag.Type(), @fieldParentPtr("base", base)).startProgress(prog_node);
593 },593 },
...@@ -597,7 +597,7 @@ pub const File = struct {...@@ -597,7 +597,7 @@ pub const File = struct {
597 pub fn endProgress(base: *File) void {597 pub fn endProgress(base: *File) void {
598 switch (base.tag) {598 switch (base.tag) {
599 else => {},599 else => {},
600 inline .elf2, .coff2 => |tag| {600 inline .elf2, .coff => |tag| {
601 dev.check(tag.devFeature());601 dev.check(tag.devFeature());
602 return @as(*tag.Type(), @fieldParentPtr("base", base)).endProgress();602 return @as(*tag.Type(), @fieldParentPtr("base", base)).endProgress();
603 },603 },
...@@ -651,10 +651,10 @@ pub const File = struct {...@@ -651,10 +651,10 @@ pub const File = struct {
651 }651 }
652 base.file = try emit.root_dir.handle.openFile(io, emit.sub_path, .{ .mode = .read_write });652 base.file = try emit.root_dir.handle.openFile(io, emit.sub_path, .{ .mode = .read_write });
653 },653 },
654 .elf2, .coff2 => if (base.file == null) {654 .elf2, .coff => if (base.file == null) {
655 const mf = if (base.cast(.elf2)) |elf|655 const mf = if (base.cast(.elf2)) |elf|
656 &elf.mf656 &elf.mf
657 else if (base.cast(.coff2)) |coff|657 else if (base.cast(.coff)) |coff|
658 &coff.mf658 &coff.mf
659 else659 else
660 unreachable;660 unreachable;
...@@ -740,10 +740,10 @@ pub const File = struct {...@@ -740,10 +740,10 @@ pub const File = struct {
740 }740 }
741 }741 }
742 },742 },
743 .elf2, .coff2 => if (base.file) |f| {743 .elf2, .coff => if (base.file) |f| {
744 const mf = if (base.cast(.elf2)) |elf|744 const mf = if (base.cast(.elf2)) |elf|
745 &elf.mf745 &elf.mf
746 else if (base.cast(.coff2)) |coff|746 else if (base.cast(.coff)) |coff|
747 &coff.mf747 &coff.mf
748 else748 else
749 unreachable;749 unreachable;
...@@ -841,7 +841,7 @@ pub const File = struct {...@@ -841,7 +841,7 @@ pub const File = struct {
841 switch (base.tag) {841 switch (base.tag) {
842 .lld => unreachable,842 .lld => unreachable,
843 else => {},843 else => {},
844 inline .elf, .elf2, .c, .coff2 => |tag| {844 inline .elf, .elf2, .c, .coff => |tag| {
845 dev.check(tag.devFeature());845 dev.check(tag.devFeature());
846 return @as(*tag.Type(), @fieldParentPtr("base", base)).updateContainerType(pt, ty, success);846 return @as(*tag.Type(), @fieldParentPtr("base", base)).updateContainerType(pt, ty, success);
847 },847 },
...@@ -899,7 +899,7 @@ pub const File = struct {...@@ -899,7 +899,7 @@ pub const File = struct {
899 .lld => unreachable,899 .lld => unreachable,
900 .plan9 => unreachable,900 .plan9 => unreachable,
901 .spirv => {},901 .spirv => {},
902 .coff2 => {},902 .coff => {},
903 inline else => |tag| {903 inline else => |tag| {
904 dev.check(tag.devFeature());904 dev.check(tag.devFeature());
905 return @as(*tag.Type(), @fieldParentPtr("base", base)).updateLineNumber(pt, ti_id, line);905 return @as(*tag.Type(), @fieldParentPtr("base", base)).updateLineNumber(pt, ti_id, line);
...@@ -951,7 +951,7 @@ pub const File = struct {...@@ -951,7 +951,7 @@ pub const File = struct {
951 pub fn idle(base: *File, tid: Zcu.PerThread.Id) Error!bool {951 pub fn idle(base: *File, tid: Zcu.PerThread.Id) Error!bool {
952 switch (base.tag) {952 switch (base.tag) {
953 else => return false,953 else => return false,
954 inline .elf2, .coff2 => |tag| {954 inline .elf2, .coff => |tag| {
955 dev.check(tag.devFeature());955 dev.check(tag.devFeature());
956 return @as(*tag.Type(), @fieldParentPtr("base", base)).idle(tid);956 return @as(*tag.Type(), @fieldParentPtr("base", base)).idle(tid);
957 },957 },
...@@ -961,7 +961,7 @@ pub const File = struct {...@@ -961,7 +961,7 @@ pub const File = struct {
961 pub fn updateErrorData(base: *File, pt: Zcu.PerThread) Error!void {961 pub fn updateErrorData(base: *File, pt: Zcu.PerThread) Error!void {
962 switch (base.tag) {962 switch (base.tag) {
963 else => {},963 else => {},
964 inline .elf2, .coff2 => |tag| {964 inline .elf2, .coff => |tag| {
965 dev.check(tag.devFeature());965 dev.check(tag.devFeature());
966 return @as(*tag.Type(), @fieldParentPtr("base", base)).updateErrorData(pt);966 return @as(*tag.Type(), @fieldParentPtr("base", base)).updateErrorData(pt);
967 },967 },
...@@ -1242,7 +1242,7 @@ pub const File = struct {...@@ -1242,7 +1242,7 @@ pub const File = struct {
1242 assert(!base.post_prelink);1242 assert(!base.post_prelink);
12431243
1244 switch (base.tag) {1244 switch (base.tag) {
1245 inline .coff2, .elf, .elf2, .wasm, .spirv => |tag| {1245 inline .coff, .elf, .elf2, .wasm, .spirv => |tag| {
1246 dev.check(tag.devFeature());1246 dev.check(tag.devFeature());
1247 return @as(*tag.Type(), @fieldParentPtr("base", base)).loadInput(input);1247 return @as(*tag.Type(), @fieldParentPtr("base", base)).loadInput(input);
1248 },1248 },
...@@ -1261,7 +1261,7 @@ pub const File = struct {...@@ -1261,7 +1261,7 @@ pub const File = struct {
1261 }1261 }
12621262
1263 switch (base.tag) {1263 switch (base.tag) {
1264 inline .elf2, .coff2, .wasm, .c => |tag| {1264 inline .elf2, .coff, .wasm, .c => |tag| {
1265 dev.check(tag.devFeature());1265 dev.check(tag.devFeature());
1266 try @as(*tag.Type(), @fieldParentPtr("base", base)).prelink(base.comp.link_prog_node);1266 try @as(*tag.Type(), @fieldParentPtr("base", base)).prelink(base.comp.link_prog_node);
1267 },1267 },
...@@ -1302,7 +1302,7 @@ pub const File = struct {...@@ -1302,7 +1302,7 @@ pub const File = struct {
1302 }1302 }
13031303
1304 pub const Tag = enum {1304 pub const Tag = enum {
1305 coff2,1305 coff,
1306 elf,1306 elf,
1307 elf2,1307 elf2,
1308 macho,1308 macho,
...@@ -1315,7 +1315,7 @@ pub const File = struct {...@@ -1315,7 +1315,7 @@ pub const File = struct {
13151315
1316 pub fn Type(comptime tag: Tag) type {1316 pub fn Type(comptime tag: Tag) type {
1317 return switch (tag) {1317 return switch (tag) {
1318 .coff2 => Coff2,1318 .coff => Coff,
1319 .elf => Elf,1319 .elf => Elf,
1320 .elf2 => Elf2,1320 .elf2 => Elf2,
1321 .macho => MachO,1321 .macho => MachO,
...@@ -1330,7 +1330,7 @@ pub const File = struct {...@@ -1330,7 +1330,7 @@ pub const File = struct {
13301330
1331 fn fromObjectFormat(ofmt: std.Target.ObjectFormat, use_new_linker: bool) Tag {1331 fn fromObjectFormat(ofmt: std.Target.ObjectFormat, use_new_linker: bool) Tag {
1332 return switch (ofmt) {1332 return switch (ofmt) {
1333 .coff => .coff2,1333 .coff => .coff,
1334 .elf => if (use_new_linker) .elf2 else .elf,1334 .elf => if (use_new_linker) .elf2 else .elf,
1335 .macho => .macho,1335 .macho => .macho,
1336 .wasm => .wasm,1336 .wasm => .wasm,
...@@ -1420,7 +1420,7 @@ pub const File = struct {...@@ -1420,7 +1420,7 @@ pub const File = struct {
14201420
1421 pub const Lld = @import("link/Lld.zig");1421 pub const Lld = @import("link/Lld.zig");
1422 pub const C = @import("link/C.zig");1422 pub const C = @import("link/C.zig");
1423 pub const Coff2 = @import("link/Coff.zig");1423 pub const Coff = @import("link/Coff.zig");
1424 pub const Spork8 = @import("link/Spork8.zig");1424 pub const Spork8 = @import("link/Spork8.zig");
1425 pub const Elf = @import("link/Elf.zig");1425 pub const Elf = @import("link/Elf.zig");
1426 pub const Elf2 = @import("link/Elf2.zig");1426 pub const Elf2 = @import("link/Elf2.zig");
src/link/Coff.zig+1-1
...@@ -1607,7 +1607,7 @@ fn create(...@@ -1607,7 +1607,7 @@ fn create(
1607 errdefer file.close(io);1607 errdefer file.close(io);
1608 coff.* = .{1608 coff.* = .{
1609 .base = .{1609 .base = .{
1610 .tag = .coff2,1610 .tag = .coff,
16111611
1612 .comp = comp,1612 .comp = comp,
1613 .emit = path,1613 .emit = path,