| ... | ... | @@ -4206,23 +4206,78 @@ fn performAllTheWorkInner( |
| 4206 | 4206 | // compiler-rt due to LLD bugs as well, e.g.: |
| 4207 | 4207 | // |
| 4208 | 4208 | // https://github.com/llvm/llvm-project/issues/43698#issuecomment-2542660611 |
| 4209 | | comp.link_task_wait_group.spawnManager(buildRt, .{ comp, "compiler_rt.zig", "compiler_rt", .compiler_rt, .Lib, false, &comp.compiler_rt_lib, main_progress_node }); |
| 4209 | comp.link_task_wait_group.spawnManager(buildRt, .{ |
| 4210 | comp, |
| 4211 | "compiler_rt.zig", |
| 4212 | "compiler_rt", |
| 4213 | .Lib, |
| 4214 | .compiler_rt, |
| 4215 | main_progress_node, |
| 4216 | RtOptions{ |
| 4217 | .checks_valgrind = true, |
| 4218 | .allow_lto = false, |
| 4219 | }, |
| 4220 | &comp.compiler_rt_lib, |
| 4221 | }); |
| 4210 | 4222 | } |
| 4211 | 4223 | |
| 4212 | 4224 | if (comp.queued_jobs.compiler_rt_obj and comp.compiler_rt_obj == null) { |
| 4213 | | comp.link_task_wait_group.spawnManager(buildRt, .{ comp, "compiler_rt.zig", "compiler_rt", .compiler_rt, .Obj, false, &comp.compiler_rt_obj, main_progress_node }); |
| 4225 | comp.link_task_wait_group.spawnManager(buildRt, .{ |
| 4226 | comp, |
| 4227 | "compiler_rt.zig", |
| 4228 | "compiler_rt", |
| 4229 | .Obj, |
| 4230 | .compiler_rt, |
| 4231 | main_progress_node, |
| 4232 | RtOptions{ |
| 4233 | .checks_valgrind = true, |
| 4234 | .allow_lto = false, |
| 4235 | }, |
| 4236 | &comp.compiler_rt_obj, |
| 4237 | }); |
| 4214 | 4238 | } |
| 4215 | 4239 | |
| 4216 | 4240 | if (comp.queued_jobs.fuzzer_lib and comp.fuzzer_lib == null) { |
| 4217 | | comp.link_task_wait_group.spawnManager(buildRt, .{ comp, "fuzzer.zig", "fuzzer", .libfuzzer, .Lib, true, &comp.fuzzer_lib, main_progress_node }); |
| 4241 | comp.link_task_wait_group.spawnManager(buildRt, .{ |
| 4242 | comp, |
| 4243 | "fuzzer.zig", |
| 4244 | "fuzzer", |
| 4245 | .Lib, |
| 4246 | .libfuzzer, |
| 4247 | main_progress_node, |
| 4248 | RtOptions{}, |
| 4249 | &comp.fuzzer_lib, |
| 4250 | }); |
| 4218 | 4251 | } |
| 4219 | 4252 | |
| 4220 | 4253 | if (comp.queued_jobs.ubsan_rt_lib and comp.ubsan_rt_lib == null) { |
| 4221 | | comp.link_task_wait_group.spawnManager(buildRt, .{ comp, "ubsan_rt.zig", "ubsan_rt", .libubsan, .Lib, false, &comp.ubsan_rt_lib, main_progress_node }); |
| 4254 | comp.link_task_wait_group.spawnManager(buildRt, .{ |
| 4255 | comp, |
| 4256 | "ubsan_rt.zig", |
| 4257 | "ubsan_rt", |
| 4258 | .Lib, |
| 4259 | .libubsan, |
| 4260 | main_progress_node, |
| 4261 | RtOptions{ |
| 4262 | .allow_lto = false, |
| 4263 | }, |
| 4264 | &comp.ubsan_rt_lib, |
| 4265 | }); |
| 4222 | 4266 | } |
| 4223 | 4267 | |
| 4224 | 4268 | if (comp.queued_jobs.ubsan_rt_obj and comp.ubsan_rt_obj == null) { |
| 4225 | | comp.link_task_wait_group.spawnManager(buildRt, .{ comp, "ubsan_rt.zig", "ubsan_rt", .libubsan, .Obj, false, &comp.ubsan_rt_obj, main_progress_node }); |
| 4269 | comp.link_task_wait_group.spawnManager(buildRt, .{ |
| 4270 | comp, |
| 4271 | "ubsan_rt.zig", |
| 4272 | "ubsan_rt", |
| 4273 | .Obj, |
| 4274 | .libubsan, |
| 4275 | main_progress_node, |
| 4276 | RtOptions{ |
| 4277 | .allow_lto = false, |
| 4278 | }, |
| 4279 | &comp.ubsan_rt_obj, |
| 4280 | }); |
| 4226 | 4281 | } |
| 4227 | 4282 | |
| 4228 | 4283 | if (comp.queued_jobs.glibc_shared_objects) { |
| ... | ... | @@ -5201,24 +5256,29 @@ fn workerUpdateWin32Resource( |
| 5201 | 5256 | }; |
| 5202 | 5257 | } |
| 5203 | 5258 | |
| 5259 | pub const RtOptions = struct { |
| 5260 | checks_valgrind: bool = false, |
| 5261 | allow_lto: bool = true, |
| 5262 | }; |
| 5263 | |
| 5204 | 5264 | fn buildRt( |
| 5205 | 5265 | comp: *Compilation, |
| 5206 | 5266 | root_source_name: []const u8, |
| 5207 | 5267 | root_name: []const u8, |
| 5208 | | misc_task: MiscTask, |
| 5209 | 5268 | output_mode: std.builtin.OutputMode, |
| 5210 | | allow_lto: bool, |
| 5211 | | out: *?CrtFile, |
| 5269 | misc_task: MiscTask, |
| 5212 | 5270 | prog_node: std.Progress.Node, |
| 5271 | options: RtOptions, |
| 5272 | out: *?CrtFile, |
| 5213 | 5273 | ) void { |
| 5214 | 5274 | comp.buildOutputFromZig( |
| 5215 | 5275 | root_source_name, |
| 5216 | 5276 | root_name, |
| 5217 | 5277 | output_mode, |
| 5218 | | allow_lto, |
| 5219 | | out, |
| 5220 | 5278 | misc_task, |
| 5221 | 5279 | prog_node, |
| 5280 | options, |
| 5281 | out, |
| 5222 | 5282 | ) catch |err| switch (err) { |
| 5223 | 5283 | error.SubCompilationFailed => return, // error reported already |
| 5224 | 5284 | else => comp.lockAndSetMiscFailure(misc_task, "unable to build {s}: {s}", .{ |
| ... | ... | @@ -5370,10 +5430,10 @@ fn buildLibZigC(comp: *Compilation, prog_node: std.Progress.Node) void { |
| 5370 | 5430 | "c.zig", |
| 5371 | 5431 | "zigc", |
| 5372 | 5432 | .Lib, |
| 5373 | | true, |
| 5374 | | &comp.zigc_static_lib, |
| 5375 | 5433 | .libzigc, |
| 5376 | 5434 | prog_node, |
| 5435 | .{}, |
| 5436 | &comp.zigc_static_lib, |
| 5377 | 5437 | ) catch |err| switch (err) { |
| 5378 | 5438 | error.SubCompilationFailed => return, // error reported already |
| 5379 | 5439 | else => comp.lockAndSetMiscFailure(.libzigc, "unable to build libzigc: {s}", .{@errorName(err)}), |
| ... | ... | @@ -7044,10 +7104,10 @@ fn buildOutputFromZig( |
| 7044 | 7104 | src_basename: []const u8, |
| 7045 | 7105 | root_name: []const u8, |
| 7046 | 7106 | output_mode: std.builtin.OutputMode, |
| 7047 | | allow_lto: bool, |
| 7048 | | out: *?CrtFile, |
| 7049 | 7107 | misc_task_tag: MiscTask, |
| 7050 | 7108 | prog_node: std.Progress.Node, |
| 7109 | options: RtOptions, |
| 7110 | out: *?CrtFile, |
| 7051 | 7111 | ) !void { |
| 7052 | 7112 | const tracy_trace = trace(@src()); |
| 7053 | 7113 | defer tracy_trace.end(); |
| ... | ... | @@ -7075,7 +7135,7 @@ fn buildOutputFromZig( |
| 7075 | 7135 | .any_unwind_tables = comp.root_mod.unwind_tables != .none, |
| 7076 | 7136 | .any_error_tracing = false, |
| 7077 | 7137 | .root_error_tracing = false, |
| 7078 | | .lto = if (allow_lto) comp.config.lto else .none, |
| 7138 | .lto = if (options.allow_lto) comp.config.lto else .none, |
| 7079 | 7139 | }); |
| 7080 | 7140 | |
| 7081 | 7141 | const root_mod = try Package.Module.create(arena, .{ |
| ... | ... | @@ -7098,6 +7158,7 @@ fn buildOutputFromZig( |
| 7098 | 7158 | .no_builtin = true, |
| 7099 | 7159 | .code_model = comp.root_mod.code_model, |
| 7100 | 7160 | .error_tracing = false, |
| 7161 | .valgrind = if (options.checks_valgrind) comp.root_mod.valgrind else null, |
| 7101 | 7162 | }, |
| 7102 | 7163 | .global = config, |
| 7103 | 7164 | .cc_argv = &.{}, |