diff options
| author | Jacob Young <jacobly0@users.noreply.github.com> | 2025-09-21 23:14:28 -0400 |
|---|---|---|
| committer | Jacob Young <jacobly0@users.noreply.github.com> | 2025-10-02 17:44:52 -0400 |
| commit | e1f3fc6ce289502cde1e52fa946476ff8e3bcaac (patch) | |
| tree | 42231ed7f2348c3c19b495bf8d4eac3acbfce21b /src/Compilation.zig | |
| parent | d5f09f56e0327685dfcaeb889efd9d6a26461886 (diff) | |
| download | zig-e1f3fc6ce289502cde1e52fa946476ff8e3bcaac.tar.gz zig-e1f3fc6ce289502cde1e52fa946476ff8e3bcaac.zip | |
Coff2: create a new linker from scratch
Diffstat (limited to 'src/Compilation.zig')
| -rw-r--r-- | src/Compilation.zig | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig index 86b1356a3f..593841deb7 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; } } } |
