diff options
| author | Jacob Young <15544577+jacobly0@users.noreply.github.com> | 2025-10-03 05:03:44 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-03 05:03:44 -0400 |
| commit | 12ed0ff1efa71d11f6220d9cf94202b888e177fc (patch) | |
| tree | 58679862045c06d8ebe2f1c67bedb5f6f91eb3fa /src/Compilation.zig | |
| parent | 1f083e9ed78f5c3c2d848d0abc58612c4ce88804 (diff) | |
| parent | 759e038a44eda0c950f0a5baac37b3a1d7f786b3 (diff) | |
| download | zig-12ed0ff1efa71d11f6220d9cf94202b888e177fc.tar.gz zig-12ed0ff1efa71d11f6220d9cf94202b888e177fc.zip | |
Merge pull request #25430 from jacobly0/x86_64-win
Coff2: create a new linker from scratch
Diffstat (limited to 'src/Compilation.zig')
| -rw-r--r-- | src/Compilation.zig | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig index f13a232e47..7574fefc20 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -256,8 +256,8 @@ test_filters: []const []const u8, link_task_wait_group: WaitGroup = .{}, link_prog_node: std.Progress.Node = .none, -link_uav_prog_node: std.Progress.Node = .none, -link_lazy_prog_node: std.Progress.Node = .none, +link_const_prog_node: std.Progress.Node = .none, +link_synth_prog_node: std.Progress.Node = .none, llvm_opt_bisect_limit: c_int, @@ -1982,13 +1982,13 @@ pub fn create(gpa: Allocator, arena: Allocator, diag: *CreateDiagnostic, options }; if (have_zcu and (!need_llvm or use_llvm)) { if (output_mode == .Obj) break :s .zcu; - if (options.config.use_new_linker) break :s .zcu; switch (target_util.zigBackend(target, use_llvm)) { else => {}, .stage2_aarch64, .stage2_x86_64 => if (target.ofmt == .coff) { break :s if (is_exe_or_dyn_lib) .dyn_lib else .zcu; }, } + if (options.config.use_new_linker) break :s .zcu; } if (need_llvm and !build_options.have_llvm) break :s .none; // impossible to build without llvm if (is_exe_or_dyn_lib) break :s .lib; @@ -3081,22 +3081,30 @@ pub fn update(comp: *Compilation, main_progress_node: std.Progress.Node) UpdateE comp.link_prog_node = main_progress_node.start("Linking", 0); if (lf.cast(.elf2)) |elf| { comp.link_prog_node.increaseEstimatedTotalItems(3); - comp.link_uav_prog_node = comp.link_prog_node.start("Constants", 0); - comp.link_lazy_prog_node = comp.link_prog_node.start("Synthetics", 0); + comp.link_const_prog_node = comp.link_prog_node.start("Constants", 0); + comp.link_synth_prog_node = comp.link_prog_node.start("Synthetics", 0); elf.mf.update_prog_node = comp.link_prog_node.start("Relocations", elf.mf.updates.items.len); + } else if (lf.cast(.coff2)) |coff| { + comp.link_prog_node.increaseEstimatedTotalItems(3); + comp.link_const_prog_node = comp.link_prog_node.start("Constants", 0); + comp.link_synth_prog_node = comp.link_prog_node.start("Synthetics", 0); + coff.mf.update_prog_node = comp.link_prog_node.start("Relocations", coff.mf.updates.items.len); } } defer { comp.link_prog_node.end(); comp.link_prog_node = .none; - comp.link_uav_prog_node.end(); - comp.link_uav_prog_node = .none; - comp.link_lazy_prog_node.end(); - comp.link_lazy_prog_node = .none; + comp.link_const_prog_node.end(); + comp.link_const_prog_node = .none; + comp.link_synth_prog_node.end(); + comp.link_synth_prog_node = .none; if (comp.bin_file) |lf| { if (lf.cast(.elf2)) |elf| { elf.mf.update_prog_node.end(); elf.mf.update_prog_node = .none; + } else if (lf.cast(.coff2)) |coff| { + coff.mf.update_prog_node.end(); + coff.mf.update_prog_node = .none; } } } @@ -3218,7 +3226,7 @@ pub fn update(comp: *Compilation, main_progress_node: std.Progress.Node) UpdateE .root_dir = comp.dirs.local_cache, .sub_path = try fs.path.join(arena, &.{ o_sub_path, comp.emit_bin.? }), }; - const result: link.File.OpenError!void = switch (need_writable_dance) { + const result: (link.File.OpenError || error{HotSwapUnavailableOnHostOperatingSystem})!void = switch (need_writable_dance) { .no => {}, .lf_only => lf.makeWritable(), .lf_and_debug => res: { |
