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-27 10:19:03+01:00
loge4d1bd610534c9a6ed01a17481bc4b6dc5b7d8dc
treed37cfde392588392596d845b8b21c86b3ae3b805
parentfd0baa9834293be085fd15929437f83986fb2243
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
......@@ -862,7 +862,7 @@ pub fn genNavRef(
862862 if (is_threadlocal) zo.symbols.items[sym_index].flags.tlv = true;
863863 return @fromBackingInt(@intCast(sym_index));
864864 }
865 } else if (lf.cast(.coff2)) |coff| {
865 } else if (lf.cast(.coff)) |coff| {
866866 return @fromBackingInt(@intCast(@backingInt(try coff.navSymbol(zcu, nav_index))));
867867 } else {
868868 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 {
142142 else if (emit.bin_file.cast(.macho)) |macho_file|
143143 @fromBackingInt(@intCast(macho_file.getZigObject().?.getOrCreateMetadataForLazySymbol(macho_file, emit.pt, lazy_sym) catch |err|
144144 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|
146146 @fromBackingInt(@intCast(@backingInt(try coff.lazySymbol(lazy_sym))))
147147 else
148148 return emit.fail("lazy symbols unimplemented for {s}", .{@tagName(emit.bin_file.tag)}),
......@@ -157,7 +157,7 @@ pub fn emitMir(emit: *Emit) Error!void {
157157 .type = .FUNC,
158158 }) else if (emit.bin_file.cast(.macho)) |macho_file|
159159 @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(.{
161161 .name = extern_func.toSlice(&emit.lower.mir).?,
162162 })))) else return emit.fail("external symbol unimplemented for {s}", .{@tagName(emit.bin_file.tag)}),
163163 .is_extern = true,
......@@ -171,7 +171,7 @@ pub fn emitMir(emit: *Emit) Error!void {
171171 switch (lowered_inst.encoding.mnemonic) {
172172 .call => {
173173 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) {
175175 try emit.encodeInst(try .new(.none, .call, &.{
176176 .{ .mem = .initRip(.ptr, 0) },
177177 }, emit.lower.target), reloc_info);
......@@ -252,7 +252,7 @@ pub fn emitMir(emit: *Emit) Error!void {
252252 }, emit.lower.target), reloc_info),
253253 else => unreachable,
254254 }
255 } else if (emit.bin_file.cast(.coff2)) |_| {
255 } else if (emit.bin_file.cast(.coff)) |_| {
256256 if (target.is_dll_import) switch (lowered_inst.encoding.mnemonic) {
257257 .lea => try emit.encodeInst(try .new(.none, .mov, &.{
258258 lowered_inst.ops[0],
......@@ -372,7 +372,7 @@ pub fn emitMir(emit: *Emit) Error!void {
372372 }, emit.lower.target), &.{});
373373 },
374374 else => unreachable,
375 } else if (emit.bin_file.cast(.coff2)) |coff| {
375 } else if (emit.bin_file.cast(.coff)) |coff| {
376376 switch (emit.lower.target.cpu.arch) {
377377 else => unreachable,
378378 .x86 => {
......@@ -845,7 +845,7 @@ fn encodeInst(emit: *Emit, lowered_inst: Instruction, reloc_info: []const RelocI
845845 if (target.is_extern and !target.force_pcrel_direct) break :rt .GOTPCREL;
846846 break :rt .PC32;
847847 } },
848 ) else if (emit.bin_file.cast(.coff2)) |coff| try coff.addReloc(
848 ) else if (emit.bin_file.cast(.coff)) |coff| try coff.addReloc(
849849 @fromBackingInt(@intCast(@backingInt(emit.atom_id))),
850850 end_offset - 4,
851851 @fromBackingInt(@intCast(@backingInt(target.symbol))),
......@@ -883,7 +883,7 @@ fn encodeInst(emit: *Emit, lowered_inst: Instruction, reloc_info: []const RelocI
883883 .symbolnum = @intCast(@backingInt(target.symbol)),
884884 },
885885 });
886 } else if (emit.bin_file.cast(.coff2)) |coff| try coff.addReloc(
886 } else if (emit.bin_file.cast(.coff)) |coff| try coff.addReloc(
887887 @fromBackingInt(@intCast(@backingInt(emit.atom_id))),
888888 end_offset - 4,
889889 @fromBackingInt(@intCast(@backingInt(target.symbol))),
......@@ -941,7 +941,7 @@ fn encodeInst(emit: *Emit, lowered_inst: Instruction, reloc_info: []const RelocI
941941 .symbolnum = @intCast(@backingInt(target.symbol)),
942942 },
943943 });
944 } else if (emit.bin_file.cast(.coff2)) |coff| try coff.addReloc(
944 } else if (emit.bin_file.cast(.coff)) |coff| try coff.addReloc(
945945 @fromBackingInt(@intCast(@backingInt(emit.atom_id))),
946946 end_offset - 4,
947947 @fromBackingInt(@intCast(@backingInt(target.symbol))),
src/dev.zig+1-3
......@@ -109,7 +109,6 @@ pub const Env = enum {
109109 .spork8_backend,
110110 .lld_linker,
111111 .coff_linker,
112 .coff2_linker,
113112 .elf_linker,
114113 .elf2_linker,
115114 .macho_linker,
......@@ -231,7 +230,7 @@ pub const Env = enum {
231230 .incremental,
232231 .legalize,
233232 .x86_64_backend,
234 .coff2_linker,
233 .coff_linker,
235234 => true,
236235 else => Env.sema.supports(feature),
237236 },
......@@ -321,7 +320,6 @@ pub const Feature = enum {
321320
322321 lld_linker,
323322 coff_linker,
324 coff2_linker,
325323 elf_linker,
326324 elf2_linker,
327325 macho_linker,
src/link.zig+16-16
......@@ -587,7 +587,7 @@ pub const File = struct {
587587 pub fn startProgress(base: *File, prog_node: std.Progress.Node) void {
588588 switch (base.tag) {
589589 else => {},
590 inline .elf2, .coff2 => |tag| {
590 inline .elf2, .coff => |tag| {
591591 dev.check(tag.devFeature());
592592 return @as(*tag.Type(), @fieldParentPtr("base", base)).startProgress(prog_node);
593593 },
......@@ -597,7 +597,7 @@ pub const File = struct {
597597 pub fn endProgress(base: *File) void {
598598 switch (base.tag) {
599599 else => {},
600 inline .elf2, .coff2 => |tag| {
600 inline .elf2, .coff => |tag| {
601601 dev.check(tag.devFeature());
602602 return @as(*tag.Type(), @fieldParentPtr("base", base)).endProgress();
603603 },
......@@ -651,10 +651,10 @@ pub const File = struct {
651651 }
652652 base.file = try emit.root_dir.handle.openFile(io, emit.sub_path, .{ .mode = .read_write });
653653 },
654 .elf2, .coff2 => if (base.file == null) {
654 .elf2, .coff => if (base.file == null) {
655655 const mf = if (base.cast(.elf2)) |elf|
656656 &elf.mf
657 else if (base.cast(.coff2)) |coff|
657 else if (base.cast(.coff)) |coff|
658658 &coff.mf
659659 else
660660 unreachable;
......@@ -740,10 +740,10 @@ pub const File = struct {
740740 }
741741 }
742742 },
743 .elf2, .coff2 => if (base.file) |f| {
743 .elf2, .coff => if (base.file) |f| {
744744 const mf = if (base.cast(.elf2)) |elf|
745745 &elf.mf
746 else if (base.cast(.coff2)) |coff|
746 else if (base.cast(.coff)) |coff|
747747 &coff.mf
748748 else
749749 unreachable;
......@@ -841,7 +841,7 @@ pub const File = struct {
841841 switch (base.tag) {
842842 .lld => unreachable,
843843 else => {},
844 inline .elf, .elf2, .c, .coff2 => |tag| {
844 inline .elf, .elf2, .c, .coff => |tag| {
845845 dev.check(tag.devFeature());
846846 return @as(*tag.Type(), @fieldParentPtr("base", base)).updateContainerType(pt, ty, success);
847847 },
......@@ -899,7 +899,7 @@ pub const File = struct {
899899 .lld => unreachable,
900900 .plan9 => unreachable,
901901 .spirv => {},
902 .coff2 => {},
902 .coff => {},
903903 inline else => |tag| {
904904 dev.check(tag.devFeature());
905905 return @as(*tag.Type(), @fieldParentPtr("base", base)).updateLineNumber(pt, ti_id, line);
......@@ -951,7 +951,7 @@ pub const File = struct {
951951 pub fn idle(base: *File, tid: Zcu.PerThread.Id) Error!bool {
952952 switch (base.tag) {
953953 else => return false,
954 inline .elf2, .coff2 => |tag| {
954 inline .elf2, .coff => |tag| {
955955 dev.check(tag.devFeature());
956956 return @as(*tag.Type(), @fieldParentPtr("base", base)).idle(tid);
957957 },
......@@ -961,7 +961,7 @@ pub const File = struct {
961961 pub fn updateErrorData(base: *File, pt: Zcu.PerThread) Error!void {
962962 switch (base.tag) {
963963 else => {},
964 inline .elf2, .coff2 => |tag| {
964 inline .elf2, .coff => |tag| {
965965 dev.check(tag.devFeature());
966966 return @as(*tag.Type(), @fieldParentPtr("base", base)).updateErrorData(pt);
967967 },
......@@ -1242,7 +1242,7 @@ pub const File = struct {
12421242 assert(!base.post_prelink);
12431243
12441244 switch (base.tag) {
1245 inline .coff2, .elf, .elf2, .wasm, .spirv => |tag| {
1245 inline .coff, .elf, .elf2, .wasm, .spirv => |tag| {
12461246 dev.check(tag.devFeature());
12471247 return @as(*tag.Type(), @fieldParentPtr("base", base)).loadInput(input);
12481248 },
......@@ -1261,7 +1261,7 @@ pub const File = struct {
12611261 }
12621262
12631263 switch (base.tag) {
1264 inline .elf2, .coff2, .wasm, .c => |tag| {
1264 inline .elf2, .coff, .wasm, .c => |tag| {
12651265 dev.check(tag.devFeature());
12661266 try @as(*tag.Type(), @fieldParentPtr("base", base)).prelink(base.comp.link_prog_node);
12671267 },
......@@ -1302,7 +1302,7 @@ pub const File = struct {
13021302 }
13031303
13041304 pub const Tag = enum {
1305 coff2,
1305 coff,
13061306 elf,
13071307 elf2,
13081308 macho,
......@@ -1315,7 +1315,7 @@ pub const File = struct {
13151315
13161316 pub fn Type(comptime tag: Tag) type {
13171317 return switch (tag) {
1318 .coff2 => Coff2,
1318 .coff => Coff,
13191319 .elf => Elf,
13201320 .elf2 => Elf2,
13211321 .macho => MachO,
......@@ -1330,7 +1330,7 @@ pub const File = struct {
13301330
13311331 fn fromObjectFormat(ofmt: std.Target.ObjectFormat, use_new_linker: bool) Tag {
13321332 return switch (ofmt) {
1333 .coff => .coff2,
1333 .coff => .coff,
13341334 .elf => if (use_new_linker) .elf2 else .elf,
13351335 .macho => .macho,
13361336 .wasm => .wasm,
......@@ -1420,7 +1420,7 @@ pub const File = struct {
14201420
14211421 pub const Lld = @import("link/Lld.zig");
14221422 pub const C = @import("link/C.zig");
1423 pub const Coff2 = @import("link/Coff.zig");
1423 pub const Coff = @import("link/Coff.zig");
14241424 pub const Spork8 = @import("link/Spork8.zig");
14251425 pub const Elf = @import("link/Elf.zig");
14261426 pub const Elf2 = @import("link/Elf2.zig");
src/link/Coff.zig+1-1
......@@ -1607,7 +1607,7 @@ fn create(
16071607 errdefer file.close(io);
16081608 coff.* = .{
16091609 .base = .{
1610 .tag = .coff2,
1610 .tag = .coff,
16111611
16121612 .comp = comp,
16131613 .emit = path,