diff --git a/src/codegen.zig b/src/codegen.zig index f1ddcab5750d0d311bcfbbefcf6cad82125b996a..b8917bc02ccc0bf6f262d3eb090472f59aaf1dea 100644 --- a/src/codegen.zig +++ b/src/codegen.zig @@ -878,7 +878,7 @@ pub fn genNavRef( }, .link_once => unreachable, } - } else if (lf.cast(.coff2)) |coff| { + } else if (lf.cast(.coff)) |coff| { return @fromBackingInt(@intCast(@backingInt(try coff.navSymbol(zcu, nav_index)))); } else { std.debug.panic("TODO genNavRef for '{t}'", .{lf.tag}); diff --git a/src/codegen/x86_64/Emit.zig b/src/codegen/x86_64/Emit.zig index eddc1f1b9341485ac0802140bbe0f1efbd08efa7..6dcaf2173d2f1fb36cf8940a0146881de02cfb93 100644 --- a/src/codegen/x86_64/Emit.zig +++ b/src/codegen/x86_64/Emit.zig @@ -142,7 +142,7 @@ pub fn emitMir(emit: *Emit) Error!void { else if (emit.bin_file.cast(.macho)) |macho_file| @fromBackingInt(@intCast(macho_file.getZigObject().?.getOrCreateMetadataForLazySymbol(macho_file, emit.pt, lazy_sym) catch |err| return emit.fail("{s} creating lazy symbol", .{@errorName(err)}))) - else if (emit.bin_file.cast(.coff2)) |coff| + else if (emit.bin_file.cast(.coff)) |coff| @fromBackingInt(@intCast(@backingInt(try coff.lazySymbol(lazy_sym)))) else return emit.fail("lazy symbols unimplemented for {s}", .{@tagName(emit.bin_file.tag)}), @@ -157,7 +157,7 @@ pub fn emitMir(emit: *Emit) Error!void { .type = .FUNC, }) else if (emit.bin_file.cast(.macho)) |macho_file| @fromBackingInt(@intCast(try macho_file.getGlobalSymbol(extern_func.toSlice(&emit.lower.mir).?, null))) - else if (emit.bin_file.cast(.coff2)) |coff| @fromBackingInt(@intCast(@backingInt(try coff.globalSymbol(.{ + else if (emit.bin_file.cast(.coff)) |coff| @fromBackingInt(@intCast(@backingInt(try coff.globalSymbol(.{ .name = extern_func.toSlice(&emit.lower.mir).?, })))) else return emit.fail("external symbol unimplemented for {s}", .{@tagName(emit.bin_file.tag)}), .is_extern = true, @@ -171,7 +171,7 @@ pub fn emitMir(emit: *Emit) Error!void { switch (lowered_inst.encoding.mnemonic) { .call => { reloc.target = .{ .branch = target }; - if (target.is_dll_import and emit.bin_file.cast(.coff2) != null) { + if (target.is_dll_import and emit.bin_file.cast(.coff) != null) { try emit.encodeInst(try .new(.none, .call, &.{ .{ .mem = .initRip(.ptr, 0) }, }, emit.lower.target), reloc_info); @@ -252,7 +252,7 @@ pub fn emitMir(emit: *Emit) Error!void { }, emit.lower.target), reloc_info), else => unreachable, } - } else if (emit.bin_file.cast(.coff2)) |_| { + } else if (emit.bin_file.cast(.coff)) |_| { if (target.is_dll_import) switch (lowered_inst.encoding.mnemonic) { .lea => try emit.encodeInst(try .new(.none, .mov, &.{ lowered_inst.ops[0], @@ -372,7 +372,7 @@ pub fn emitMir(emit: *Emit) Error!void { }, emit.lower.target), &.{}); }, else => unreachable, - } else if (emit.bin_file.cast(.coff2)) |coff| { + } else if (emit.bin_file.cast(.coff)) |coff| { switch (emit.lower.target.cpu.arch) { else => unreachable, .x86 => { @@ -845,7 +845,7 @@ fn encodeInst(emit: *Emit, lowered_inst: Instruction, reloc_info: []const RelocI if (target.is_extern and !target.force_pcrel_direct) break :rt .GOTPCREL; break :rt .PC32; } }, - ) else if (emit.bin_file.cast(.coff2)) |coff| try coff.addReloc( + ) else if (emit.bin_file.cast(.coff)) |coff| try coff.addReloc( @fromBackingInt(@intCast(@backingInt(emit.atom_id))), end_offset - 4, @fromBackingInt(@intCast(@backingInt(target.symbol))), @@ -883,7 +883,7 @@ fn encodeInst(emit: *Emit, lowered_inst: Instruction, reloc_info: []const RelocI .symbolnum = @intCast(@backingInt(target.symbol)), }, }); - } else if (emit.bin_file.cast(.coff2)) |coff| try coff.addReloc( + } else if (emit.bin_file.cast(.coff)) |coff| try coff.addReloc( @fromBackingInt(@intCast(@backingInt(emit.atom_id))), end_offset - 4, @fromBackingInt(@intCast(@backingInt(target.symbol))), @@ -941,7 +941,7 @@ fn encodeInst(emit: *Emit, lowered_inst: Instruction, reloc_info: []const RelocI .symbolnum = @intCast(@backingInt(target.symbol)), }, }); - } else if (emit.bin_file.cast(.coff2)) |coff| try coff.addReloc( + } else if (emit.bin_file.cast(.coff)) |coff| try coff.addReloc( @fromBackingInt(@intCast(@backingInt(emit.atom_id))), end_offset - 4, @fromBackingInt(@intCast(@backingInt(target.symbol))), diff --git a/src/dev.zig b/src/dev.zig index e8b62bd420f5d6e9472252cd021db4f122971f1d..683824812a06bb09bb45a25bd43dcf7ecdb6f372 100644 --- a/src/dev.zig +++ b/src/dev.zig @@ -109,7 +109,6 @@ pub const Env = enum { .spork8_backend, .lld_linker, .coff_linker, - .coff2_linker, .elf_linker, .elf2_linker, .macho_linker, @@ -231,7 +230,7 @@ pub const Env = enum { .incremental, .legalize, .x86_64_backend, - .coff2_linker, + .coff_linker, => true, else => Env.sema.supports(feature), }, @@ -321,7 +320,6 @@ pub const Feature = enum { lld_linker, coff_linker, - coff2_linker, elf_linker, elf2_linker, macho_linker, diff --git a/src/link.zig b/src/link.zig index 6b2d2eecdf7f644ddaa94b71a701de983173fda5..0e2d6e2ff5c54184fb473a25dee0a2488e3e746f 100644 --- a/src/link.zig +++ b/src/link.zig @@ -587,7 +587,7 @@ pub const File = struct { pub fn startProgress(base: *File, prog_node: std.Progress.Node) void { switch (base.tag) { else => {}, - inline .elf2, .coff2 => |tag| { + inline .elf2, .coff => |tag| { dev.check(tag.devFeature()); return @as(*tag.Type(), @fieldParentPtr("base", base)).startProgress(prog_node); }, @@ -597,7 +597,7 @@ pub const File = struct { pub fn endProgress(base: *File) void { switch (base.tag) { else => {}, - inline .elf2, .coff2 => |tag| { + inline .elf2, .coff => |tag| { dev.check(tag.devFeature()); return @as(*tag.Type(), @fieldParentPtr("base", base)).endProgress(); }, @@ -651,10 +651,10 @@ pub const File = struct { } base.file = try emit.root_dir.handle.openFile(io, emit.sub_path, .{ .mode = .read_write }); }, - .elf2, .coff2 => if (base.file == null) { + .elf2, .coff => if (base.file == null) { const mf = if (base.cast(.elf2)) |elf| &elf.mf - else if (base.cast(.coff2)) |coff| + else if (base.cast(.coff)) |coff| &coff.mf else unreachable; @@ -740,10 +740,10 @@ pub const File = struct { } } }, - .elf2, .coff2 => if (base.file) |f| { + .elf2, .coff => if (base.file) |f| { const mf = if (base.cast(.elf2)) |elf| &elf.mf - else if (base.cast(.coff2)) |coff| + else if (base.cast(.coff)) |coff| &coff.mf else unreachable; @@ -841,7 +841,7 @@ pub const File = struct { switch (base.tag) { .lld => unreachable, else => {}, - inline .elf, .elf2, .c, .coff2 => |tag| { + inline .elf, .elf2, .c, .coff => |tag| { dev.check(tag.devFeature()); return @as(*tag.Type(), @fieldParentPtr("base", base)).updateContainerType(pt, ty, success); }, @@ -899,7 +899,7 @@ pub const File = struct { .lld => unreachable, .plan9 => unreachable, .spirv => {}, - .coff2 => {}, + .coff => {}, inline else => |tag| { dev.check(tag.devFeature()); return @as(*tag.Type(), @fieldParentPtr("base", base)).updateLineNumber(pt, ti_id, line); @@ -951,7 +951,7 @@ pub const File = struct { pub fn idle(base: *File, tid: Zcu.PerThread.Id) Error!bool { switch (base.tag) { else => return false, - inline .elf2, .coff2 => |tag| { + inline .elf2, .coff => |tag| { dev.check(tag.devFeature()); return @as(*tag.Type(), @fieldParentPtr("base", base)).idle(tid); }, @@ -961,7 +961,7 @@ pub const File = struct { pub fn updateErrorData(base: *File, pt: Zcu.PerThread) Error!void { switch (base.tag) { else => {}, - inline .elf2, .coff2 => |tag| { + inline .elf2, .coff => |tag| { dev.check(tag.devFeature()); return @as(*tag.Type(), @fieldParentPtr("base", base)).updateErrorData(pt); }, @@ -1242,7 +1242,7 @@ pub const File = struct { assert(!base.post_prelink); switch (base.tag) { - inline .coff2, .elf, .elf2, .wasm, .spirv => |tag| { + inline .coff, .elf, .elf2, .wasm, .spirv => |tag| { dev.check(tag.devFeature()); return @as(*tag.Type(), @fieldParentPtr("base", base)).loadInput(input); }, @@ -1261,7 +1261,7 @@ pub const File = struct { } switch (base.tag) { - inline .elf2, .coff2, .wasm, .c => |tag| { + inline .elf2, .coff, .wasm, .c => |tag| { dev.check(tag.devFeature()); try @as(*tag.Type(), @fieldParentPtr("base", base)).prelink(base.comp.link_prog_node); }, @@ -1302,7 +1302,7 @@ pub const File = struct { } pub const Tag = enum { - coff2, + coff, elf, elf2, macho, @@ -1315,7 +1315,7 @@ pub const File = struct { pub fn Type(comptime tag: Tag) type { return switch (tag) { - .coff2 => Coff2, + .coff => Coff, .elf => Elf, .elf2 => Elf2, .macho => MachO, @@ -1330,7 +1330,7 @@ pub const File = struct { fn fromObjectFormat(ofmt: std.Target.ObjectFormat, use_new_linker: bool) Tag { return switch (ofmt) { - .coff => .coff2, + .coff => .coff, .elf => if (use_new_linker) .elf2 else .elf, .macho => .macho, .wasm => .wasm, @@ -1420,7 +1420,7 @@ pub const File = struct { pub const Lld = @import("link/Lld.zig"); pub const C = @import("link/C.zig"); - pub const Coff2 = @import("link/Coff.zig"); + pub const Coff = @import("link/Coff.zig"); pub const Spork8 = @import("link/Spork8.zig"); pub const Elf = @import("link/Elf.zig"); pub const Elf2 = @import("link/Elf2.zig"); diff --git a/src/link/Coff.zig b/src/link/Coff.zig index 250dbd388658148ff196567923b5e0de593f72eb..1aa577aa45026387561fc81794ce7e43f42b71be 100644 --- a/src/link/Coff.zig +++ b/src/link/Coff.zig @@ -1607,7 +1607,7 @@ fn create( errdefer file.close(io); coff.* = .{ .base = .{ - .tag = .coff2, + .tag = .coff, .comp = comp, .emit = path,