| ... | ... | @@ -3695,15 +3695,19 @@ fn performAllTheWorkInner( |
| 3695 | 3695 | // In case it failed last time, try again. `clearMiscFailures` was already |
| 3696 | 3696 | // called at the start of `update`. |
| 3697 | 3697 | if (comp.queued_jobs.compiler_rt_lib and comp.compiler_rt_lib == null) { |
| 3698 | | comp.link_task_wait_group.spawnManager(buildRt, .{ comp, "compiler_rt.zig", .compiler_rt, .Lib, &comp.compiler_rt_lib, main_progress_node }); |
| 3698 | // LLVM disables LTO for its compiler-rt and we've had various issues with LTO of our |
| 3699 | // compiler-rt due to LLD bugs as well, e.g.: |
| 3700 | // |
| 3701 | // https://github.com/llvm/llvm-project/issues/43698#issuecomment-2542660611 |
| 3702 | comp.link_task_wait_group.spawnManager(buildRt, .{ comp, "compiler_rt.zig", .compiler_rt, .Lib, false, &comp.compiler_rt_lib, main_progress_node }); |
| 3699 | 3703 | } |
| 3700 | 3704 | |
| 3701 | 3705 | if (comp.queued_jobs.compiler_rt_obj and comp.compiler_rt_obj == null) { |
| 3702 | | comp.link_task_wait_group.spawnManager(buildRt, .{ comp, "compiler_rt.zig", .compiler_rt, .Obj, &comp.compiler_rt_obj, main_progress_node }); |
| 3706 | comp.link_task_wait_group.spawnManager(buildRt, .{ comp, "compiler_rt.zig", .compiler_rt, .Obj, false, &comp.compiler_rt_obj, main_progress_node }); |
| 3703 | 3707 | } |
| 3704 | 3708 | |
| 3705 | 3709 | if (comp.queued_jobs.fuzzer_lib and comp.fuzzer_lib == null) { |
| 3706 | | comp.link_task_wait_group.spawnManager(buildRt, .{ comp, "fuzzer.zig", .libfuzzer, .Lib, &comp.fuzzer_lib, main_progress_node }); |
| 3710 | comp.link_task_wait_group.spawnManager(buildRt, .{ comp, "fuzzer.zig", .libfuzzer, .Lib, true, &comp.fuzzer_lib, main_progress_node }); |
| 3707 | 3711 | } |
| 3708 | 3712 | |
| 3709 | 3713 | if (comp.queued_jobs.glibc_shared_objects) { |
| ... | ... | @@ -4635,12 +4639,14 @@ fn buildRt( |
| 4635 | 4639 | root_source_name: []const u8, |
| 4636 | 4640 | misc_task: MiscTask, |
| 4637 | 4641 | output_mode: std.builtin.OutputMode, |
| 4642 | allow_lto: bool, |
| 4638 | 4643 | out: *?CrtFile, |
| 4639 | 4644 | prog_node: std.Progress.Node, |
| 4640 | 4645 | ) void { |
| 4641 | 4646 | comp.buildOutputFromZig( |
| 4642 | 4647 | root_source_name, |
| 4643 | 4648 | output_mode, |
| 4649 | allow_lto, |
| 4644 | 4650 | out, |
| 4645 | 4651 | misc_task, |
| 4646 | 4652 | prog_node, |
| ... | ... | @@ -4748,6 +4754,7 @@ fn buildZigLibc(comp: *Compilation, prog_node: std.Progress.Node) void { |
| 4748 | 4754 | comp.buildOutputFromZig( |
| 4749 | 4755 | "c.zig", |
| 4750 | 4756 | .Lib, |
| 4757 | true, |
| 4751 | 4758 | &comp.libc_static_lib, |
| 4752 | 4759 | .zig_libc, |
| 4753 | 4760 | prog_node, |
| ... | ... | @@ -6453,6 +6460,7 @@ fn buildOutputFromZig( |
| 6453 | 6460 | comp: *Compilation, |
| 6454 | 6461 | src_basename: []const u8, |
| 6455 | 6462 | output_mode: std.builtin.OutputMode, |
| 6463 | allow_lto: bool, |
| 6456 | 6464 | out: *?CrtFile, |
| 6457 | 6465 | misc_task_tag: MiscTask, |
| 6458 | 6466 | prog_node: std.Progress.Node, |
| ... | ... | @@ -6481,6 +6489,7 @@ fn buildOutputFromZig( |
| 6481 | 6489 | .root_strip = strip, |
| 6482 | 6490 | .link_libc = comp.config.link_libc, |
| 6483 | 6491 | .any_unwind_tables = comp.root_mod.unwind_tables != .none, |
| 6492 | .lto = if (allow_lto) comp.config.lto else .none, |
| 6484 | 6493 | }); |
| 6485 | 6494 | |
| 6486 | 6495 | const root_mod = try Package.Module.create(arena, .{ |
| ... | ... | @@ -6581,6 +6590,8 @@ pub const CrtFileOptions = struct { |
| 6581 | 6590 | unwind_tables: ?std.builtin.UnwindTables = null, |
| 6582 | 6591 | pic: ?bool = null, |
| 6583 | 6592 | no_builtin: ?bool = null, |
| 6593 | |
| 6594 | allow_lto: bool = true, |
| 6584 | 6595 | }; |
| 6585 | 6596 | |
| 6586 | 6597 | pub fn build_crt_file( |
| ... | ... | @@ -6619,7 +6630,7 @@ pub fn build_crt_file( |
| 6619 | 6630 | .link_libc = false, |
| 6620 | 6631 | .any_unwind_tables = options.unwind_tables != .none, |
| 6621 | 6632 | .lto = switch (output_mode) { |
| 6622 | | .Lib => comp.config.lto, |
| 6633 | .Lib => if (options.allow_lto) comp.config.lto else .none, |
| 6623 | 6634 | .Obj, .Exe => .none, |
| 6624 | 6635 | }, |
| 6625 | 6636 | }); |