| ... | @@ -2384,7 +2384,6 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil | ... | @@ -2384,7 +2384,6 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil |
| 2384 | }; | 2384 | }; |
| 2385 | comp.c_object_table.putAssumeCapacityNoClobber(c_object, {}); | 2385 | comp.c_object_table.putAssumeCapacityNoClobber(c_object, {}); |
| 2386 | } | 2386 | } |
| 2387 | comp.link_task_queue.pending_prelink_tasks += @intCast(comp.c_object_table.count()); | | |
| 2388 | | 2387 | |
| 2389 | // Add a `Win32Resource` for each `rc_source_files` and one for `manifest_file`. | 2388 | // Add a `Win32Resource` for each `rc_source_files` and one for `manifest_file`. |
| 2390 | const win32_resource_count = | 2389 | const win32_resource_count = |
| ... | @@ -2392,10 +2391,6 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil | ... | @@ -2392,10 +2391,6 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil |
| 2392 | if (win32_resource_count > 0) { | 2391 | if (win32_resource_count > 0) { |
| 2393 | dev.check(.win32_resource); | 2392 | dev.check(.win32_resource); |
| 2394 | try comp.win32_resource_table.ensureTotalCapacity(gpa, win32_resource_count); | 2393 | try comp.win32_resource_table.ensureTotalCapacity(gpa, win32_resource_count); |
| 2395 | // Add this after adding logic to updateWin32Resource to pass the | | |
| 2396 | // result into link.loadInput. loadInput integration is not implemented | | |
| 2397 | // for Windows linking logic yet. | | |
| 2398 | //comp.link_task_queue.pending_prelink_tasks += @intCast(win32_resource_count); | | |
| 2399 | for (options.rc_source_files) |rc_source_file| { | 2394 | for (options.rc_source_files) |rc_source_file| { |
| 2400 | const win32_resource = try gpa.create(Win32Resource); | 2395 | const win32_resource = try gpa.create(Win32Resource); |
| 2401 | errdefer gpa.destroy(win32_resource); | 2396 | errdefer gpa.destroy(win32_resource); |
| ... | @@ -2454,58 +2449,47 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil | ... | @@ -2454,58 +2449,47 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil |
| 2454 | | 2449 | |
| 2455 | if (musl.needsCrt0(comp.config.output_mode, comp.config.link_mode, comp.config.pie)) |f| { | 2450 | if (musl.needsCrt0(comp.config.output_mode, comp.config.link_mode, comp.config.pie)) |f| { |
| 2456 | comp.queued_jobs.musl_crt_file[@intFromEnum(f)] = true; | 2451 | comp.queued_jobs.musl_crt_file[@intFromEnum(f)] = true; |
| 2457 | comp.link_task_queue.pending_prelink_tasks += 1; | | |
| 2458 | } | 2452 | } |
| 2459 | switch (comp.config.link_mode) { | 2453 | switch (comp.config.link_mode) { |
| 2460 | .static => comp.queued_jobs.musl_crt_file[@intFromEnum(musl.CrtFile.libc_a)] = true, | 2454 | .static => comp.queued_jobs.musl_crt_file[@intFromEnum(musl.CrtFile.libc_a)] = true, |
| 2461 | .dynamic => comp.queued_jobs.musl_crt_file[@intFromEnum(musl.CrtFile.libc_so)] = true, | 2455 | .dynamic => comp.queued_jobs.musl_crt_file[@intFromEnum(musl.CrtFile.libc_so)] = true, |
| 2462 | } | 2456 | } |
| 2463 | comp.link_task_queue.pending_prelink_tasks += 1; | | |
| 2464 | } else if (target.isGnuLibC()) { | 2457 | } else if (target.isGnuLibC()) { |
| 2465 | if (!std.zig.target.canBuildLibC(target)) return error.LibCUnavailable; | 2458 | if (!std.zig.target.canBuildLibC(target)) return error.LibCUnavailable; |
| 2466 | | 2459 | |
| 2467 | if (glibc.needsCrt0(comp.config.output_mode)) |f| { | 2460 | if (glibc.needsCrt0(comp.config.output_mode)) |f| { |
| 2468 | comp.queued_jobs.glibc_crt_file[@intFromEnum(f)] = true; | 2461 | comp.queued_jobs.glibc_crt_file[@intFromEnum(f)] = true; |
| 2469 | comp.link_task_queue.pending_prelink_tasks += 1; | | |
| 2470 | } | 2462 | } |
| 2471 | comp.queued_jobs.glibc_shared_objects = true; | 2463 | comp.queued_jobs.glibc_shared_objects = true; |
| 2472 | comp.link_task_queue.pending_prelink_tasks += glibc.sharedObjectsCount(target); | | |
| 2473 | | 2464 | |
| 2474 | comp.queued_jobs.glibc_crt_file[@intFromEnum(glibc.CrtFile.libc_nonshared_a)] = true; | 2465 | comp.queued_jobs.glibc_crt_file[@intFromEnum(glibc.CrtFile.libc_nonshared_a)] = true; |
| 2475 | comp.link_task_queue.pending_prelink_tasks += 1; | | |
| 2476 | } else if (target.isFreeBSDLibC()) { | 2466 | } else if (target.isFreeBSDLibC()) { |
| 2477 | if (!std.zig.target.canBuildLibC(target)) return error.LibCUnavailable; | 2467 | if (!std.zig.target.canBuildLibC(target)) return error.LibCUnavailable; |
| 2478 | | 2468 | |
| 2479 | if (freebsd.needsCrt0(comp.config.output_mode)) |f| { | 2469 | if (freebsd.needsCrt0(comp.config.output_mode)) |f| { |
| 2480 | comp.queued_jobs.freebsd_crt_file[@intFromEnum(f)] = true; | 2470 | comp.queued_jobs.freebsd_crt_file[@intFromEnum(f)] = true; |
| 2481 | comp.link_task_queue.pending_prelink_tasks += 1; | | |
| 2482 | } | 2471 | } |
| 2483 | | 2472 | |
| 2484 | comp.queued_jobs.freebsd_shared_objects = true; | 2473 | comp.queued_jobs.freebsd_shared_objects = true; |
| 2485 | comp.link_task_queue.pending_prelink_tasks += freebsd.sharedObjectsCount(); | | |
| 2486 | } else if (target.isNetBSDLibC()) { | 2474 | } else if (target.isNetBSDLibC()) { |
| 2487 | if (!std.zig.target.canBuildLibC(target)) return error.LibCUnavailable; | 2475 | if (!std.zig.target.canBuildLibC(target)) return error.LibCUnavailable; |
| 2488 | | 2476 | |
| 2489 | if (netbsd.needsCrt0(comp.config.output_mode)) |f| { | 2477 | if (netbsd.needsCrt0(comp.config.output_mode)) |f| { |
| 2490 | comp.queued_jobs.netbsd_crt_file[@intFromEnum(f)] = true; | 2478 | comp.queued_jobs.netbsd_crt_file[@intFromEnum(f)] = true; |
| 2491 | comp.link_task_queue.pending_prelink_tasks += 1; | | |
| 2492 | } | 2479 | } |
| 2493 | | 2480 | |
| 2494 | comp.queued_jobs.netbsd_shared_objects = true; | 2481 | comp.queued_jobs.netbsd_shared_objects = true; |
| 2495 | comp.link_task_queue.pending_prelink_tasks += netbsd.sharedObjectsCount(); | | |
| 2496 | } else if (target.isWasiLibC()) { | 2482 | } else if (target.isWasiLibC()) { |
| 2497 | if (!std.zig.target.canBuildLibC(target)) return error.LibCUnavailable; | 2483 | if (!std.zig.target.canBuildLibC(target)) return error.LibCUnavailable; |
| 2498 | | 2484 | |
| 2499 | comp.queued_jobs.wasi_libc_crt_file[@intFromEnum(wasi_libc.execModelCrtFile(comp.config.wasi_exec_model))] = true; | 2485 | comp.queued_jobs.wasi_libc_crt_file[@intFromEnum(wasi_libc.execModelCrtFile(comp.config.wasi_exec_model))] = true; |
| 2500 | comp.queued_jobs.wasi_libc_crt_file[@intFromEnum(wasi_libc.CrtFile.libc_a)] = true; | 2486 | comp.queued_jobs.wasi_libc_crt_file[@intFromEnum(wasi_libc.CrtFile.libc_a)] = true; |
| 2501 | comp.link_task_queue.pending_prelink_tasks += 2; | | |
| 2502 | } else if (target.isMinGW()) { | 2487 | } else if (target.isMinGW()) { |
| 2503 | if (!std.zig.target.canBuildLibC(target)) return error.LibCUnavailable; | 2488 | if (!std.zig.target.canBuildLibC(target)) return error.LibCUnavailable; |
| 2504 | | 2489 | |
| 2505 | const main_crt_file: mingw.CrtFile = if (is_dyn_lib) .dllcrt2_o else .crt2_o; | 2490 | const main_crt_file: mingw.CrtFile = if (is_dyn_lib) .dllcrt2_o else .crt2_o; |
| 2506 | comp.queued_jobs.mingw_crt_file[@intFromEnum(main_crt_file)] = true; | 2491 | comp.queued_jobs.mingw_crt_file[@intFromEnum(main_crt_file)] = true; |
| 2507 | comp.queued_jobs.mingw_crt_file[@intFromEnum(mingw.CrtFile.libmingw32_lib)] = true; | 2492 | comp.queued_jobs.mingw_crt_file[@intFromEnum(mingw.CrtFile.libmingw32_lib)] = true; |
| 2508 | comp.link_task_queue.pending_prelink_tasks += 2; | | |
| 2509 | | 2493 | |
| 2510 | // When linking mingw-w64 there are some import libs we always need. | 2494 | // When linking mingw-w64 there are some import libs we always need. |
| 2511 | try comp.windows_libs.ensureUnusedCapacity(gpa, mingw.always_link_libs.len); | 2495 | try comp.windows_libs.ensureUnusedCapacity(gpa, mingw.always_link_libs.len); |
| ... | @@ -2519,7 +2503,6 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil | ... | @@ -2519,7 +2503,6 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil |
| 2519 | target.isMinGW()) | 2503 | target.isMinGW()) |
| 2520 | { | 2504 | { |
| 2521 | comp.queued_jobs.zigc_lib = true; | 2505 | comp.queued_jobs.zigc_lib = true; |
| 2522 | comp.link_task_queue.pending_prelink_tasks += 1; | | |
| 2523 | } | 2506 | } |
| 2524 | } | 2507 | } |
| 2525 | | 2508 | |
| ... | @@ -2536,50 +2519,41 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil | ... | @@ -2536,50 +2519,41 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil |
| 2536 | } | 2519 | } |
| 2537 | if (comp.wantBuildLibUnwindFromSource()) { | 2520 | if (comp.wantBuildLibUnwindFromSource()) { |
| 2538 | comp.queued_jobs.libunwind = true; | 2521 | comp.queued_jobs.libunwind = true; |
| 2539 | comp.link_task_queue.pending_prelink_tasks += 1; | | |
| 2540 | } | 2522 | } |
| 2541 | if (build_options.have_llvm and is_exe_or_dyn_lib and comp.config.link_libcpp) { | 2523 | if (build_options.have_llvm and is_exe_or_dyn_lib and comp.config.link_libcpp) { |
| 2542 | comp.queued_jobs.libcxx = true; | 2524 | comp.queued_jobs.libcxx = true; |
| 2543 | comp.queued_jobs.libcxxabi = true; | 2525 | comp.queued_jobs.libcxxabi = true; |
| 2544 | comp.link_task_queue.pending_prelink_tasks += 2; | | |
| 2545 | } | 2526 | } |
| 2546 | if (build_options.have_llvm and is_exe_or_dyn_lib and comp.config.any_sanitize_thread) { | 2527 | if (build_options.have_llvm and is_exe_or_dyn_lib and comp.config.any_sanitize_thread) { |
| 2547 | comp.queued_jobs.libtsan = true; | 2528 | comp.queued_jobs.libtsan = true; |
| 2548 | comp.link_task_queue.pending_prelink_tasks += 1; | | |
| 2549 | } | 2529 | } |
| 2550 | | 2530 | |
| 2551 | if (can_build_compiler_rt) { | 2531 | if (can_build_compiler_rt) { |
| 2552 | if (comp.compiler_rt_strat == .lib) { | 2532 | if (comp.compiler_rt_strat == .lib) { |
| 2553 | log.debug("queuing a job to build compiler_rt_lib", .{}); | 2533 | log.debug("queuing a job to build compiler_rt_lib", .{}); |
| 2554 | comp.queued_jobs.compiler_rt_lib = true; | 2534 | comp.queued_jobs.compiler_rt_lib = true; |
| 2555 | comp.link_task_queue.pending_prelink_tasks += 1; | | |
| 2556 | } else if (comp.compiler_rt_strat == .obj) { | 2535 | } else if (comp.compiler_rt_strat == .obj) { |
| 2557 | log.debug("queuing a job to build compiler_rt_obj", .{}); | 2536 | log.debug("queuing a job to build compiler_rt_obj", .{}); |
| 2558 | // In this case we are making a static library, so we ask | 2537 | // In this case we are making a static library, so we ask |
| 2559 | // for a compiler-rt object to put in it. | 2538 | // for a compiler-rt object to put in it. |
| 2560 | comp.queued_jobs.compiler_rt_obj = true; | 2539 | comp.queued_jobs.compiler_rt_obj = true; |
| 2561 | comp.link_task_queue.pending_prelink_tasks += 1; | | |
| 2562 | } else if (comp.compiler_rt_strat == .dyn_lib) { | 2540 | } else if (comp.compiler_rt_strat == .dyn_lib) { |
| 2563 | // hack for stage2_x86_64 + coff | 2541 | // hack for stage2_x86_64 + coff |
| 2564 | log.debug("queuing a job to build compiler_rt_dyn_lib", .{}); | 2542 | log.debug("queuing a job to build compiler_rt_dyn_lib", .{}); |
| 2565 | comp.queued_jobs.compiler_rt_dyn_lib = true; | 2543 | comp.queued_jobs.compiler_rt_dyn_lib = true; |
| 2566 | comp.link_task_queue.pending_prelink_tasks += 1; | | |
| 2567 | } | 2544 | } |
| 2568 | | 2545 | |
| 2569 | if (comp.ubsan_rt_strat == .lib) { | 2546 | if (comp.ubsan_rt_strat == .lib) { |
| 2570 | log.debug("queuing a job to build ubsan_rt_lib", .{}); | 2547 | log.debug("queuing a job to build ubsan_rt_lib", .{}); |
| 2571 | comp.queued_jobs.ubsan_rt_lib = true; | 2548 | comp.queued_jobs.ubsan_rt_lib = true; |
| 2572 | comp.link_task_queue.pending_prelink_tasks += 1; | | |
| 2573 | } else if (comp.ubsan_rt_strat == .obj) { | 2549 | } else if (comp.ubsan_rt_strat == .obj) { |
| 2574 | log.debug("queuing a job to build ubsan_rt_obj", .{}); | 2550 | log.debug("queuing a job to build ubsan_rt_obj", .{}); |
| 2575 | comp.queued_jobs.ubsan_rt_obj = true; | 2551 | comp.queued_jobs.ubsan_rt_obj = true; |
| 2576 | comp.link_task_queue.pending_prelink_tasks += 1; | | |
| 2577 | } | 2552 | } |
| 2578 | | 2553 | |
| 2579 | if (is_exe_or_dyn_lib and comp.config.any_fuzz) { | 2554 | if (is_exe_or_dyn_lib and comp.config.any_fuzz) { |
| 2580 | log.debug("queuing a job to build libfuzzer", .{}); | 2555 | log.debug("queuing a job to build libfuzzer", .{}); |
| 2581 | comp.queued_jobs.fuzzer_lib = true; | 2556 | comp.queued_jobs.fuzzer_lib = true; |
| 2582 | comp.link_task_queue.pending_prelink_tasks += 1; | | |
| 2583 | } | 2557 | } |
| 2584 | } | 2558 | } |
| 2585 | } | 2559 | } |
| ... | @@ -2587,8 +2561,6 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil | ... | @@ -2587,8 +2561,6 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil |
| 2587 | try comp.link_task_queue.queued_prelink.append(gpa, .load_explicitly_provided); | 2561 | try comp.link_task_queue.queued_prelink.append(gpa, .load_explicitly_provided); |
| 2588 | } | 2562 | } |
| 2589 | log.debug("queued prelink tasks: {d}", .{comp.link_task_queue.queued_prelink.items.len}); | 2563 | log.debug("queued prelink tasks: {d}", .{comp.link_task_queue.queued_prelink.items.len}); |
| 2590 | log.debug("pending prelink tasks: {d}", .{comp.link_task_queue.pending_prelink_tasks}); | | |
| 2591 | | | |
| 2592 | return comp; | 2564 | return comp; |
| 2593 | } | 2565 | } |
| 2594 | | 2566 | |
| ... | @@ -4408,10 +4380,8 @@ fn performAllTheWork( | ... | @@ -4408,10 +4380,8 @@ fn performAllTheWork( |
| 4408 | comp.link_task_wait_group.reset(); | 4380 | comp.link_task_wait_group.reset(); |
| 4409 | defer comp.link_task_wait_group.wait(); | 4381 | defer comp.link_task_wait_group.wait(); |
| 4410 | | 4382 | |
| 4411 | comp.link_prog_node.increaseEstimatedTotalItems( | 4383 | // Already-queued prelink tasks |
| 4412 | comp.link_task_queue.queued_prelink.items.len + // already queued prelink tasks | 4384 | comp.link_prog_node.increaseEstimatedTotalItems(comp.link_task_queue.queued_prelink.items.len); |
| 4413 | comp.link_task_queue.pending_prelink_tasks, // prelink tasks which will be queued | | |
| 4414 | ); | | |
| 4415 | comp.link_task_queue.start(comp); | 4385 | comp.link_task_queue.start(comp); |
| 4416 | | 4386 | |
| 4417 | if (comp.emit_docs != null) { | 4387 | if (comp.emit_docs != null) { |
| ... | @@ -4427,6 +4397,7 @@ fn performAllTheWork( | ... | @@ -4427,6 +4397,7 @@ fn performAllTheWork( |
| 4427 | // compiler-rt due to LLD bugs as well, e.g.: | 4397 | // compiler-rt due to LLD bugs as well, e.g.: |
| 4428 | // | 4398 | // |
| 4429 | // https://github.com/llvm/llvm-project/issues/43698#issuecomment-2542660611 | 4399 | // https://github.com/llvm/llvm-project/issues/43698#issuecomment-2542660611 |
| | 4400 | comp.link_task_queue.startPrelinkItem(); |
| 4430 | comp.link_task_wait_group.spawnManager(buildRt, .{ | 4401 | comp.link_task_wait_group.spawnManager(buildRt, .{ |
| 4431 | comp, | 4402 | comp, |
| 4432 | "compiler_rt.zig", | 4403 | "compiler_rt.zig", |
| ... | @@ -4444,6 +4415,7 @@ fn performAllTheWork( | ... | @@ -4444,6 +4415,7 @@ fn performAllTheWork( |
| 4444 | } | 4415 | } |
| 4445 | | 4416 | |
| 4446 | if (comp.queued_jobs.compiler_rt_obj and comp.compiler_rt_obj == null) { | 4417 | if (comp.queued_jobs.compiler_rt_obj and comp.compiler_rt_obj == null) { |
| | 4418 | comp.link_task_queue.startPrelinkItem(); |
| 4447 | comp.link_task_wait_group.spawnManager(buildRt, .{ | 4419 | comp.link_task_wait_group.spawnManager(buildRt, .{ |
| 4448 | comp, | 4420 | comp, |
| 4449 | "compiler_rt.zig", | 4421 | "compiler_rt.zig", |
| ... | @@ -4462,6 +4434,7 @@ fn performAllTheWork( | ... | @@ -4462,6 +4434,7 @@ fn performAllTheWork( |
| 4462 | | 4434 | |
| 4463 | // hack for stage2_x86_64 + coff | 4435 | // hack for stage2_x86_64 + coff |
| 4464 | if (comp.queued_jobs.compiler_rt_dyn_lib and comp.compiler_rt_dyn_lib == null) { | 4436 | if (comp.queued_jobs.compiler_rt_dyn_lib and comp.compiler_rt_dyn_lib == null) { |
| | 4437 | comp.link_task_queue.startPrelinkItem(); |
| 4465 | comp.link_task_wait_group.spawnManager(buildRt, .{ | 4438 | comp.link_task_wait_group.spawnManager(buildRt, .{ |
| 4466 | comp, | 4439 | comp, |
| 4467 | "compiler_rt.zig", | 4440 | "compiler_rt.zig", |
| ... | @@ -4479,6 +4452,7 @@ fn performAllTheWork( | ... | @@ -4479,6 +4452,7 @@ fn performAllTheWork( |
| 4479 | } | 4452 | } |
| 4480 | | 4453 | |
| 4481 | if (comp.queued_jobs.fuzzer_lib and comp.fuzzer_lib == null) { | 4454 | if (comp.queued_jobs.fuzzer_lib and comp.fuzzer_lib == null) { |
| | 4455 | comp.link_task_queue.startPrelinkItem(); |
| 4482 | comp.link_task_wait_group.spawnManager(buildRt, .{ | 4456 | comp.link_task_wait_group.spawnManager(buildRt, .{ |
| 4483 | comp, | 4457 | comp, |
| 4484 | "fuzzer.zig", | 4458 | "fuzzer.zig", |
| ... | @@ -4493,6 +4467,7 @@ fn performAllTheWork( | ... | @@ -4493,6 +4467,7 @@ fn performAllTheWork( |
| 4493 | } | 4467 | } |
| 4494 | | 4468 | |
| 4495 | if (comp.queued_jobs.ubsan_rt_lib and comp.ubsan_rt_lib == null) { | 4469 | if (comp.queued_jobs.ubsan_rt_lib and comp.ubsan_rt_lib == null) { |
| | 4470 | comp.link_task_queue.startPrelinkItem(); |
| 4496 | comp.link_task_wait_group.spawnManager(buildRt, .{ | 4471 | comp.link_task_wait_group.spawnManager(buildRt, .{ |
| 4497 | comp, | 4472 | comp, |
| 4498 | "ubsan_rt.zig", | 4473 | "ubsan_rt.zig", |
| ... | @@ -4509,6 +4484,7 @@ fn performAllTheWork( | ... | @@ -4509,6 +4484,7 @@ fn performAllTheWork( |
| 4509 | } | 4484 | } |
| 4510 | | 4485 | |
| 4511 | if (comp.queued_jobs.ubsan_rt_obj and comp.ubsan_rt_obj == null) { | 4486 | if (comp.queued_jobs.ubsan_rt_obj and comp.ubsan_rt_obj == null) { |
| | 4487 | comp.link_task_queue.startPrelinkItem(); |
| 4512 | comp.link_task_wait_group.spawnManager(buildRt, .{ | 4488 | comp.link_task_wait_group.spawnManager(buildRt, .{ |
| 4513 | comp, | 4489 | comp, |
| 4514 | "ubsan_rt.zig", | 4490 | "ubsan_rt.zig", |
| ... | @@ -4525,40 +4501,49 @@ fn performAllTheWork( | ... | @@ -4525,40 +4501,49 @@ fn performAllTheWork( |
| 4525 | } | 4501 | } |
| 4526 | | 4502 | |
| 4527 | if (comp.queued_jobs.glibc_shared_objects) { | 4503 | if (comp.queued_jobs.glibc_shared_objects) { |
| | 4504 | comp.link_task_queue.startPrelinkItem(); |
| 4528 | comp.link_task_wait_group.spawnManager(buildGlibcSharedObjects, .{ comp, main_progress_node }); | 4505 | comp.link_task_wait_group.spawnManager(buildGlibcSharedObjects, .{ comp, main_progress_node }); |
| 4529 | } | 4506 | } |
| 4530 | | 4507 | |
| 4531 | if (comp.queued_jobs.freebsd_shared_objects) { | 4508 | if (comp.queued_jobs.freebsd_shared_objects) { |
| | 4509 | comp.link_task_queue.startPrelinkItem(); |
| 4532 | comp.link_task_wait_group.spawnManager(buildFreeBSDSharedObjects, .{ comp, main_progress_node }); | 4510 | comp.link_task_wait_group.spawnManager(buildFreeBSDSharedObjects, .{ comp, main_progress_node }); |
| 4533 | } | 4511 | } |
| 4534 | | 4512 | |
| 4535 | if (comp.queued_jobs.netbsd_shared_objects) { | 4513 | if (comp.queued_jobs.netbsd_shared_objects) { |
| | 4514 | comp.link_task_queue.startPrelinkItem(); |
| 4536 | comp.link_task_wait_group.spawnManager(buildNetBSDSharedObjects, .{ comp, main_progress_node }); | 4515 | comp.link_task_wait_group.spawnManager(buildNetBSDSharedObjects, .{ comp, main_progress_node }); |
| 4537 | } | 4516 | } |
| 4538 | | 4517 | |
| 4539 | if (comp.queued_jobs.libunwind) { | 4518 | if (comp.queued_jobs.libunwind) { |
| | 4519 | comp.link_task_queue.startPrelinkItem(); |
| 4540 | comp.link_task_wait_group.spawnManager(buildLibUnwind, .{ comp, main_progress_node }); | 4520 | comp.link_task_wait_group.spawnManager(buildLibUnwind, .{ comp, main_progress_node }); |
| 4541 | } | 4521 | } |
| 4542 | | 4522 | |
| 4543 | if (comp.queued_jobs.libcxx) { | 4523 | if (comp.queued_jobs.libcxx) { |
| | 4524 | comp.link_task_queue.startPrelinkItem(); |
| 4544 | comp.link_task_wait_group.spawnManager(buildLibCxx, .{ comp, main_progress_node }); | 4525 | comp.link_task_wait_group.spawnManager(buildLibCxx, .{ comp, main_progress_node }); |
| 4545 | } | 4526 | } |
| 4546 | | 4527 | |
| 4547 | if (comp.queued_jobs.libcxxabi) { | 4528 | if (comp.queued_jobs.libcxxabi) { |
| | 4529 | comp.link_task_queue.startPrelinkItem(); |
| 4548 | comp.link_task_wait_group.spawnManager(buildLibCxxAbi, .{ comp, main_progress_node }); | 4530 | comp.link_task_wait_group.spawnManager(buildLibCxxAbi, .{ comp, main_progress_node }); |
| 4549 | } | 4531 | } |
| 4550 | | 4532 | |
| 4551 | if (comp.queued_jobs.libtsan) { | 4533 | if (comp.queued_jobs.libtsan) { |
| | 4534 | comp.link_task_queue.startPrelinkItem(); |
| 4552 | comp.link_task_wait_group.spawnManager(buildLibTsan, .{ comp, main_progress_node }); | 4535 | comp.link_task_wait_group.spawnManager(buildLibTsan, .{ comp, main_progress_node }); |
| 4553 | } | 4536 | } |
| 4554 | | 4537 | |
| 4555 | if (comp.queued_jobs.zigc_lib and comp.zigc_static_lib == null) { | 4538 | if (comp.queued_jobs.zigc_lib and comp.zigc_static_lib == null) { |
| | 4539 | comp.link_task_queue.startPrelinkItem(); |
| 4556 | comp.link_task_wait_group.spawnManager(buildLibZigC, .{ comp, main_progress_node }); | 4540 | comp.link_task_wait_group.spawnManager(buildLibZigC, .{ comp, main_progress_node }); |
| 4557 | } | 4541 | } |
| 4558 | | 4542 | |
| 4559 | for (0..@typeInfo(musl.CrtFile).@"enum".fields.len) |i| { | 4543 | for (0..@typeInfo(musl.CrtFile).@"enum".fields.len) |i| { |
| 4560 | if (comp.queued_jobs.musl_crt_file[i]) { | 4544 | if (comp.queued_jobs.musl_crt_file[i]) { |
| 4561 | const tag: musl.CrtFile = @enumFromInt(i); | 4545 | const tag: musl.CrtFile = @enumFromInt(i); |
| | 4546 | comp.link_task_queue.startPrelinkItem(); |
| 4562 | comp.link_task_wait_group.spawnManager(buildMuslCrtFile, .{ comp, tag, main_progress_node }); | 4547 | comp.link_task_wait_group.spawnManager(buildMuslCrtFile, .{ comp, tag, main_progress_node }); |
| 4563 | } | 4548 | } |
| 4564 | } | 4549 | } |
| ... | @@ -4566,6 +4551,7 @@ fn performAllTheWork( | ... | @@ -4566,6 +4551,7 @@ fn performAllTheWork( |
| 4566 | for (0..@typeInfo(glibc.CrtFile).@"enum".fields.len) |i| { | 4551 | for (0..@typeInfo(glibc.CrtFile).@"enum".fields.len) |i| { |
| 4567 | if (comp.queued_jobs.glibc_crt_file[i]) { | 4552 | if (comp.queued_jobs.glibc_crt_file[i]) { |
| 4568 | const tag: glibc.CrtFile = @enumFromInt(i); | 4553 | const tag: glibc.CrtFile = @enumFromInt(i); |
| | 4554 | comp.link_task_queue.startPrelinkItem(); |
| 4569 | comp.link_task_wait_group.spawnManager(buildGlibcCrtFile, .{ comp, tag, main_progress_node }); | 4555 | comp.link_task_wait_group.spawnManager(buildGlibcCrtFile, .{ comp, tag, main_progress_node }); |
| 4570 | } | 4556 | } |
| 4571 | } | 4557 | } |
| ... | @@ -4573,6 +4559,7 @@ fn performAllTheWork( | ... | @@ -4573,6 +4559,7 @@ fn performAllTheWork( |
| 4573 | for (0..@typeInfo(freebsd.CrtFile).@"enum".fields.len) |i| { | 4559 | for (0..@typeInfo(freebsd.CrtFile).@"enum".fields.len) |i| { |
| 4574 | if (comp.queued_jobs.freebsd_crt_file[i]) { | 4560 | if (comp.queued_jobs.freebsd_crt_file[i]) { |
| 4575 | const tag: freebsd.CrtFile = @enumFromInt(i); | 4561 | const tag: freebsd.CrtFile = @enumFromInt(i); |
| | 4562 | comp.link_task_queue.startPrelinkItem(); |
| 4576 | comp.link_task_wait_group.spawnManager(buildFreeBSDCrtFile, .{ comp, tag, main_progress_node }); | 4563 | comp.link_task_wait_group.spawnManager(buildFreeBSDCrtFile, .{ comp, tag, main_progress_node }); |
| 4577 | } | 4564 | } |
| 4578 | } | 4565 | } |
| ... | @@ -4580,6 +4567,7 @@ fn performAllTheWork( | ... | @@ -4580,6 +4567,7 @@ fn performAllTheWork( |
| 4580 | for (0..@typeInfo(netbsd.CrtFile).@"enum".fields.len) |i| { | 4567 | for (0..@typeInfo(netbsd.CrtFile).@"enum".fields.len) |i| { |
| 4581 | if (comp.queued_jobs.netbsd_crt_file[i]) { | 4568 | if (comp.queued_jobs.netbsd_crt_file[i]) { |
| 4582 | const tag: netbsd.CrtFile = @enumFromInt(i); | 4569 | const tag: netbsd.CrtFile = @enumFromInt(i); |
| | 4570 | comp.link_task_queue.startPrelinkItem(); |
| 4583 | comp.link_task_wait_group.spawnManager(buildNetBSDCrtFile, .{ comp, tag, main_progress_node }); | 4571 | comp.link_task_wait_group.spawnManager(buildNetBSDCrtFile, .{ comp, tag, main_progress_node }); |
| 4584 | } | 4572 | } |
| 4585 | } | 4573 | } |
| ... | @@ -4587,6 +4575,7 @@ fn performAllTheWork( | ... | @@ -4587,6 +4575,7 @@ fn performAllTheWork( |
| 4587 | for (0..@typeInfo(wasi_libc.CrtFile).@"enum".fields.len) |i| { | 4575 | for (0..@typeInfo(wasi_libc.CrtFile).@"enum".fields.len) |i| { |
| 4588 | if (comp.queued_jobs.wasi_libc_crt_file[i]) { | 4576 | if (comp.queued_jobs.wasi_libc_crt_file[i]) { |
| 4589 | const tag: wasi_libc.CrtFile = @enumFromInt(i); | 4577 | const tag: wasi_libc.CrtFile = @enumFromInt(i); |
| | 4578 | comp.link_task_queue.startPrelinkItem(); |
| 4590 | comp.link_task_wait_group.spawnManager(buildWasiLibcCrtFile, .{ comp, tag, main_progress_node }); | 4579 | comp.link_task_wait_group.spawnManager(buildWasiLibcCrtFile, .{ comp, tag, main_progress_node }); |
| 4591 | } | 4580 | } |
| 4592 | } | 4581 | } |
| ... | @@ -4594,6 +4583,7 @@ fn performAllTheWork( | ... | @@ -4594,6 +4583,7 @@ fn performAllTheWork( |
| 4594 | for (0..@typeInfo(mingw.CrtFile).@"enum".fields.len) |i| { | 4583 | for (0..@typeInfo(mingw.CrtFile).@"enum".fields.len) |i| { |
| 4595 | if (comp.queued_jobs.mingw_crt_file[i]) { | 4584 | if (comp.queued_jobs.mingw_crt_file[i]) { |
| 4596 | const tag: mingw.CrtFile = @enumFromInt(i); | 4585 | const tag: mingw.CrtFile = @enumFromInt(i); |
| | 4586 | comp.link_task_queue.startPrelinkItem(); |
| 4597 | comp.link_task_wait_group.spawnManager(buildMingwCrtFile, .{ comp, tag, main_progress_node }); | 4587 | comp.link_task_wait_group.spawnManager(buildMingwCrtFile, .{ comp, tag, main_progress_node }); |
| 4598 | } | 4588 | } |
| 4599 | } | 4589 | } |
| ... | @@ -4665,12 +4655,14 @@ fn performAllTheWork( | ... | @@ -4665,12 +4655,14 @@ fn performAllTheWork( |
| 4665 | } | 4655 | } |
| 4666 | | 4656 | |
| 4667 | while (comp.c_object_work_queue.readItem()) |c_object| { | 4657 | while (comp.c_object_work_queue.readItem()) |c_object| { |
| | 4658 | comp.link_task_queue.startPrelinkItem(); |
| 4668 | comp.thread_pool.spawnWg(&comp.link_task_wait_group, workerUpdateCObject, .{ | 4659 | comp.thread_pool.spawnWg(&comp.link_task_wait_group, workerUpdateCObject, .{ |
| 4669 | comp, c_object, main_progress_node, | 4660 | comp, c_object, main_progress_node, |
| 4670 | }); | 4661 | }); |
| 4671 | } | 4662 | } |
| 4672 | | 4663 | |
| 4673 | while (comp.win32_resource_work_queue.readItem()) |win32_resource| { | 4664 | while (comp.win32_resource_work_queue.readItem()) |win32_resource| { |
| | 4665 | comp.link_task_queue.startPrelinkItem(); |
| 4674 | comp.thread_pool.spawnWg(&comp.link_task_wait_group, workerUpdateWin32Resource, .{ | 4666 | comp.thread_pool.spawnWg(&comp.link_task_wait_group, workerUpdateWin32Resource, .{ |
| 4675 | comp, win32_resource, main_progress_node, | 4667 | comp, win32_resource, main_progress_node, |
| 4676 | }); | 4668 | }); |
| ... | @@ -4773,15 +4765,14 @@ fn performAllTheWork( | ... | @@ -4773,15 +4765,14 @@ fn performAllTheWork( |
| 4773 | } | 4765 | } |
| 4774 | }; | 4766 | }; |
| 4775 | | 4767 | |
| | 4768 | // We aren't going to queue any more prelink tasks. |
| | 4769 | comp.link_task_queue.finishPrelinkItem(comp); |
| | 4770 | |
| 4776 | if (!comp.separateCodegenThreadOk()) { | 4771 | if (!comp.separateCodegenThreadOk()) { |
| 4777 | // Waits until all input files have been parsed. | 4772 | // Waits until all input files have been parsed. |
| 4778 | comp.link_task_wait_group.wait(); | 4773 | comp.link_task_wait_group.wait(); |
| 4779 | comp.link_task_wait_group.reset(); | 4774 | comp.link_task_wait_group.reset(); |
| 4780 | std.log.scoped(.link).debug("finished waiting for link_task_wait_group", .{}); | 4775 | std.log.scoped(.link).debug("finished waiting for link_task_wait_group", .{}); |
| 4781 | if (comp.link_task_queue.pending_prelink_tasks > 0) { | | |
| 4782 | // Indicates an error occurred preventing prelink phase from completing. | | |
| 4783 | return; | | |
| 4784 | } | | |
| 4785 | } | 4776 | } |
| 4786 | | 4777 | |
| 4787 | if (comp.zcu != null) { | 4778 | if (comp.zcu != null) { |
| ... | @@ -5568,6 +5559,7 @@ fn workerUpdateCObject( | ... | @@ -5568,6 +5559,7 @@ fn workerUpdateCObject( |
| 5568 | c_object: *CObject, | 5559 | c_object: *CObject, |
| 5569 | progress_node: std.Progress.Node, | 5560 | progress_node: std.Progress.Node, |
| 5570 | ) void { | 5561 | ) void { |
| | 5562 | defer comp.link_task_queue.finishPrelinkItem(comp); |
| 5571 | comp.updateCObject(c_object, progress_node) catch |err| switch (err) { | 5563 | comp.updateCObject(c_object, progress_node) catch |err| switch (err) { |
| 5572 | error.AnalysisFail => return, | 5564 | error.AnalysisFail => return, |
| 5573 | else => { | 5565 | else => { |
| ... | @@ -5585,6 +5577,7 @@ fn workerUpdateWin32Resource( | ... | @@ -5585,6 +5577,7 @@ fn workerUpdateWin32Resource( |
| 5585 | win32_resource: *Win32Resource, | 5577 | win32_resource: *Win32Resource, |
| 5586 | progress_node: std.Progress.Node, | 5578 | progress_node: std.Progress.Node, |
| 5587 | ) void { | 5579 | ) void { |
| | 5580 | defer comp.link_task_queue.finishPrelinkItem(comp); |
| 5588 | comp.updateWin32Resource(win32_resource, progress_node) catch |err| switch (err) { | 5581 | comp.updateWin32Resource(win32_resource, progress_node) catch |err| switch (err) { |
| 5589 | error.AnalysisFail => return, | 5582 | error.AnalysisFail => return, |
| 5590 | else => { | 5583 | else => { |
| ... | @@ -5628,6 +5621,7 @@ fn buildRt( | ... | @@ -5628,6 +5621,7 @@ fn buildRt( |
| 5628 | options: RtOptions, | 5621 | options: RtOptions, |
| 5629 | out: *?CrtFile, | 5622 | out: *?CrtFile, |
| 5630 | ) void { | 5623 | ) void { |
| | 5624 | defer comp.link_task_queue.finishPrelinkItem(comp); |
| 5631 | comp.buildOutputFromZig( | 5625 | comp.buildOutputFromZig( |
| 5632 | root_source_name, | 5626 | root_source_name, |
| 5633 | root_name, | 5627 | root_name, |
| ... | @@ -5646,6 +5640,7 @@ fn buildRt( | ... | @@ -5646,6 +5640,7 @@ fn buildRt( |
| 5646 | } | 5640 | } |
| 5647 | | 5641 | |
| 5648 | fn buildMuslCrtFile(comp: *Compilation, crt_file: musl.CrtFile, prog_node: std.Progress.Node) void { | 5642 | fn buildMuslCrtFile(comp: *Compilation, crt_file: musl.CrtFile, prog_node: std.Progress.Node) void { |
| | 5643 | defer comp.link_task_queue.finishPrelinkItem(comp); |
| 5649 | if (musl.buildCrtFile(comp, crt_file, prog_node)) |_| { | 5644 | if (musl.buildCrtFile(comp, crt_file, prog_node)) |_| { |
| 5650 | comp.queued_jobs.musl_crt_file[@intFromEnum(crt_file)] = false; | 5645 | comp.queued_jobs.musl_crt_file[@intFromEnum(crt_file)] = false; |
| 5651 | } else |err| switch (err) { | 5646 | } else |err| switch (err) { |
| ... | @@ -5657,6 +5652,7 @@ fn buildMuslCrtFile(comp: *Compilation, crt_file: musl.CrtFile, prog_node: std.P | ... | @@ -5657,6 +5652,7 @@ fn buildMuslCrtFile(comp: *Compilation, crt_file: musl.CrtFile, prog_node: std.P |
| 5657 | } | 5652 | } |
| 5658 | | 5653 | |
| 5659 | fn buildGlibcCrtFile(comp: *Compilation, crt_file: glibc.CrtFile, prog_node: std.Progress.Node) void { | 5654 | fn buildGlibcCrtFile(comp: *Compilation, crt_file: glibc.CrtFile, prog_node: std.Progress.Node) void { |
| | 5655 | defer comp.link_task_queue.finishPrelinkItem(comp); |
| 5660 | if (glibc.buildCrtFile(comp, crt_file, prog_node)) |_| { | 5656 | if (glibc.buildCrtFile(comp, crt_file, prog_node)) |_| { |
| 5661 | comp.queued_jobs.glibc_crt_file[@intFromEnum(crt_file)] = false; | 5657 | comp.queued_jobs.glibc_crt_file[@intFromEnum(crt_file)] = false; |
| 5662 | } else |err| switch (err) { | 5658 | } else |err| switch (err) { |
| ... | @@ -5668,6 +5664,7 @@ fn buildGlibcCrtFile(comp: *Compilation, crt_file: glibc.CrtFile, prog_node: std | ... | @@ -5668,6 +5664,7 @@ fn buildGlibcCrtFile(comp: *Compilation, crt_file: glibc.CrtFile, prog_node: std |
| 5668 | } | 5664 | } |
| 5669 | | 5665 | |
| 5670 | fn buildGlibcSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) void { | 5666 | fn buildGlibcSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) void { |
| | 5667 | defer comp.link_task_queue.finishPrelinkItem(comp); |
| 5671 | if (glibc.buildSharedObjects(comp, prog_node)) |_| { | 5668 | if (glibc.buildSharedObjects(comp, prog_node)) |_| { |
| 5672 | // The job should no longer be queued up since it succeeded. | 5669 | // The job should no longer be queued up since it succeeded. |
| 5673 | comp.queued_jobs.glibc_shared_objects = false; | 5670 | comp.queued_jobs.glibc_shared_objects = false; |
| ... | @@ -5680,6 +5677,7 @@ fn buildGlibcSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) voi | ... | @@ -5680,6 +5677,7 @@ fn buildGlibcSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) voi |
| 5680 | } | 5677 | } |
| 5681 | | 5678 | |
| 5682 | fn buildFreeBSDCrtFile(comp: *Compilation, crt_file: freebsd.CrtFile, prog_node: std.Progress.Node) void { | 5679 | fn buildFreeBSDCrtFile(comp: *Compilation, crt_file: freebsd.CrtFile, prog_node: std.Progress.Node) void { |
| | 5680 | defer comp.link_task_queue.finishPrelinkItem(comp); |
| 5683 | if (freebsd.buildCrtFile(comp, crt_file, prog_node)) |_| { | 5681 | if (freebsd.buildCrtFile(comp, crt_file, prog_node)) |_| { |
| 5684 | comp.queued_jobs.freebsd_crt_file[@intFromEnum(crt_file)] = false; | 5682 | comp.queued_jobs.freebsd_crt_file[@intFromEnum(crt_file)] = false; |
| 5685 | } else |err| switch (err) { | 5683 | } else |err| switch (err) { |
| ... | @@ -5691,6 +5689,7 @@ fn buildFreeBSDCrtFile(comp: *Compilation, crt_file: freebsd.CrtFile, prog_node: | ... | @@ -5691,6 +5689,7 @@ fn buildFreeBSDCrtFile(comp: *Compilation, crt_file: freebsd.CrtFile, prog_node: |
| 5691 | } | 5689 | } |
| 5692 | | 5690 | |
| 5693 | fn buildFreeBSDSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) void { | 5691 | fn buildFreeBSDSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) void { |
| | 5692 | defer comp.link_task_queue.finishPrelinkItem(comp); |
| 5694 | if (freebsd.buildSharedObjects(comp, prog_node)) |_| { | 5693 | if (freebsd.buildSharedObjects(comp, prog_node)) |_| { |
| 5695 | // The job should no longer be queued up since it succeeded. | 5694 | // The job should no longer be queued up since it succeeded. |
| 5696 | comp.queued_jobs.freebsd_shared_objects = false; | 5695 | comp.queued_jobs.freebsd_shared_objects = false; |
| ... | @@ -5703,6 +5702,7 @@ fn buildFreeBSDSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) v | ... | @@ -5703,6 +5702,7 @@ fn buildFreeBSDSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) v |
| 5703 | } | 5702 | } |
| 5704 | | 5703 | |
| 5705 | fn buildNetBSDCrtFile(comp: *Compilation, crt_file: netbsd.CrtFile, prog_node: std.Progress.Node) void { | 5704 | fn buildNetBSDCrtFile(comp: *Compilation, crt_file: netbsd.CrtFile, prog_node: std.Progress.Node) void { |
| | 5705 | defer comp.link_task_queue.finishPrelinkItem(comp); |
| 5706 | if (netbsd.buildCrtFile(comp, crt_file, prog_node)) |_| { | 5706 | if (netbsd.buildCrtFile(comp, crt_file, prog_node)) |_| { |
| 5707 | comp.queued_jobs.netbsd_crt_file[@intFromEnum(crt_file)] = false; | 5707 | comp.queued_jobs.netbsd_crt_file[@intFromEnum(crt_file)] = false; |
| 5708 | } else |err| switch (err) { | 5708 | } else |err| switch (err) { |
| ... | @@ -5714,6 +5714,7 @@ fn buildNetBSDCrtFile(comp: *Compilation, crt_file: netbsd.CrtFile, prog_node: s | ... | @@ -5714,6 +5714,7 @@ fn buildNetBSDCrtFile(comp: *Compilation, crt_file: netbsd.CrtFile, prog_node: s |
| 5714 | } | 5714 | } |
| 5715 | | 5715 | |
| 5716 | fn buildNetBSDSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) void { | 5716 | fn buildNetBSDSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) void { |
| | 5717 | defer comp.link_task_queue.finishPrelinkItem(comp); |
| 5717 | if (netbsd.buildSharedObjects(comp, prog_node)) |_| { | 5718 | if (netbsd.buildSharedObjects(comp, prog_node)) |_| { |
| 5718 | // The job should no longer be queued up since it succeeded. | 5719 | // The job should no longer be queued up since it succeeded. |
| 5719 | comp.queued_jobs.netbsd_shared_objects = false; | 5720 | comp.queued_jobs.netbsd_shared_objects = false; |
| ... | @@ -5726,6 +5727,7 @@ fn buildNetBSDSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) vo | ... | @@ -5726,6 +5727,7 @@ fn buildNetBSDSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) vo |
| 5726 | } | 5727 | } |
| 5727 | | 5728 | |
| 5728 | fn buildMingwCrtFile(comp: *Compilation, crt_file: mingw.CrtFile, prog_node: std.Progress.Node) void { | 5729 | fn buildMingwCrtFile(comp: *Compilation, crt_file: mingw.CrtFile, prog_node: std.Progress.Node) void { |
| | 5730 | defer comp.link_task_queue.finishPrelinkItem(comp); |
| 5729 | if (mingw.buildCrtFile(comp, crt_file, prog_node)) |_| { | 5731 | if (mingw.buildCrtFile(comp, crt_file, prog_node)) |_| { |
| 5730 | comp.queued_jobs.mingw_crt_file[@intFromEnum(crt_file)] = false; | 5732 | comp.queued_jobs.mingw_crt_file[@intFromEnum(crt_file)] = false; |
| 5731 | } else |err| switch (err) { | 5733 | } else |err| switch (err) { |
| ... | @@ -5737,6 +5739,7 @@ fn buildMingwCrtFile(comp: *Compilation, crt_file: mingw.CrtFile, prog_node: std | ... | @@ -5737,6 +5739,7 @@ fn buildMingwCrtFile(comp: *Compilation, crt_file: mingw.CrtFile, prog_node: std |
| 5737 | } | 5739 | } |
| 5738 | | 5740 | |
| 5739 | fn buildWasiLibcCrtFile(comp: *Compilation, crt_file: wasi_libc.CrtFile, prog_node: std.Progress.Node) void { | 5741 | fn buildWasiLibcCrtFile(comp: *Compilation, crt_file: wasi_libc.CrtFile, prog_node: std.Progress.Node) void { |
| | 5742 | defer comp.link_task_queue.finishPrelinkItem(comp); |
| 5740 | if (wasi_libc.buildCrtFile(comp, crt_file, prog_node)) |_| { | 5743 | if (wasi_libc.buildCrtFile(comp, crt_file, prog_node)) |_| { |
| 5741 | comp.queued_jobs.wasi_libc_crt_file[@intFromEnum(crt_file)] = false; | 5744 | comp.queued_jobs.wasi_libc_crt_file[@intFromEnum(crt_file)] = false; |
| 5742 | } else |err| switch (err) { | 5745 | } else |err| switch (err) { |
| ... | @@ -5748,6 +5751,7 @@ fn buildWasiLibcCrtFile(comp: *Compilation, crt_file: wasi_libc.CrtFile, prog_no | ... | @@ -5748,6 +5751,7 @@ fn buildWasiLibcCrtFile(comp: *Compilation, crt_file: wasi_libc.CrtFile, prog_no |
| 5748 | } | 5751 | } |
| 5749 | | 5752 | |
| 5750 | fn buildLibUnwind(comp: *Compilation, prog_node: std.Progress.Node) void { | 5753 | fn buildLibUnwind(comp: *Compilation, prog_node: std.Progress.Node) void { |
| | 5754 | defer comp.link_task_queue.finishPrelinkItem(comp); |
| 5751 | if (libunwind.buildStaticLib(comp, prog_node)) |_| { | 5755 | if (libunwind.buildStaticLib(comp, prog_node)) |_| { |
| 5752 | comp.queued_jobs.libunwind = false; | 5756 | comp.queued_jobs.libunwind = false; |
| 5753 | } else |err| switch (err) { | 5757 | } else |err| switch (err) { |
| ... | @@ -5757,6 +5761,7 @@ fn buildLibUnwind(comp: *Compilation, prog_node: std.Progress.Node) void { | ... | @@ -5757,6 +5761,7 @@ fn buildLibUnwind(comp: *Compilation, prog_node: std.Progress.Node) void { |
| 5757 | } | 5761 | } |
| 5758 | | 5762 | |
| 5759 | fn buildLibCxx(comp: *Compilation, prog_node: std.Progress.Node) void { | 5763 | fn buildLibCxx(comp: *Compilation, prog_node: std.Progress.Node) void { |
| | 5764 | defer comp.link_task_queue.finishPrelinkItem(comp); |
| 5760 | if (libcxx.buildLibCxx(comp, prog_node)) |_| { | 5765 | if (libcxx.buildLibCxx(comp, prog_node)) |_| { |
| 5761 | comp.queued_jobs.libcxx = false; | 5766 | comp.queued_jobs.libcxx = false; |
| 5762 | } else |err| switch (err) { | 5767 | } else |err| switch (err) { |
| ... | @@ -5766,6 +5771,7 @@ fn buildLibCxx(comp: *Compilation, prog_node: std.Progress.Node) void { | ... | @@ -5766,6 +5771,7 @@ fn buildLibCxx(comp: *Compilation, prog_node: std.Progress.Node) void { |
| 5766 | } | 5771 | } |
| 5767 | | 5772 | |
| 5768 | fn buildLibCxxAbi(comp: *Compilation, prog_node: std.Progress.Node) void { | 5773 | fn buildLibCxxAbi(comp: *Compilation, prog_node: std.Progress.Node) void { |
| | 5774 | defer comp.link_task_queue.finishPrelinkItem(comp); |
| 5769 | if (libcxx.buildLibCxxAbi(comp, prog_node)) |_| { | 5775 | if (libcxx.buildLibCxxAbi(comp, prog_node)) |_| { |
| 5770 | comp.queued_jobs.libcxxabi = false; | 5776 | comp.queued_jobs.libcxxabi = false; |
| 5771 | } else |err| switch (err) { | 5777 | } else |err| switch (err) { |
| ... | @@ -5775,6 +5781,7 @@ fn buildLibCxxAbi(comp: *Compilation, prog_node: std.Progress.Node) void { | ... | @@ -5775,6 +5781,7 @@ fn buildLibCxxAbi(comp: *Compilation, prog_node: std.Progress.Node) void { |
| 5775 | } | 5781 | } |
| 5776 | | 5782 | |
| 5777 | fn buildLibTsan(comp: *Compilation, prog_node: std.Progress.Node) void { | 5783 | fn buildLibTsan(comp: *Compilation, prog_node: std.Progress.Node) void { |
| | 5784 | defer comp.link_task_queue.finishPrelinkItem(comp); |
| 5778 | if (libtsan.buildTsan(comp, prog_node)) |_| { | 5785 | if (libtsan.buildTsan(comp, prog_node)) |_| { |
| 5779 | comp.queued_jobs.libtsan = false; | 5786 | comp.queued_jobs.libtsan = false; |
| 5780 | } else |err| switch (err) { | 5787 | } else |err| switch (err) { |
| ... | @@ -5784,6 +5791,7 @@ fn buildLibTsan(comp: *Compilation, prog_node: std.Progress.Node) void { | ... | @@ -5784,6 +5791,7 @@ fn buildLibTsan(comp: *Compilation, prog_node: std.Progress.Node) void { |
| 5784 | } | 5791 | } |
| 5785 | | 5792 | |
| 5786 | fn buildLibZigC(comp: *Compilation, prog_node: std.Progress.Node) void { | 5793 | fn buildLibZigC(comp: *Compilation, prog_node: std.Progress.Node) void { |
| | 5794 | defer comp.link_task_queue.finishPrelinkItem(comp); |
| 5787 | comp.buildOutputFromZig( | 5795 | comp.buildOutputFromZig( |
| 5788 | "c.zig", | 5796 | "c.zig", |
| 5789 | "zigc", | 5797 | "zigc", |
| ... | @@ -7721,6 +7729,7 @@ pub fn queuePrelinkTaskMode(comp: *Compilation, path: Cache.Path, config: *const | ... | @@ -7721,6 +7729,7 @@ pub fn queuePrelinkTaskMode(comp: *Compilation, path: Cache.Path, config: *const |
| 7721 | /// Only valid to call during `update`. Automatically handles queuing up a | 7729 | /// Only valid to call during `update`. Automatically handles queuing up a |
| 7722 | /// linker worker task if there is not already one. | 7730 | /// linker worker task if there is not already one. |
| 7723 | pub fn queuePrelinkTasks(comp: *Compilation, tasks: []const link.PrelinkTask) void { | 7731 | pub fn queuePrelinkTasks(comp: *Compilation, tasks: []const link.PrelinkTask) void { |
| | 7732 | comp.link_prog_node.increaseEstimatedTotalItems(tasks.len); |
| 7724 | comp.link_task_queue.enqueuePrelink(comp, tasks) catch |err| switch (err) { | 7733 | comp.link_task_queue.enqueuePrelink(comp, tasks) catch |err| switch (err) { |
| 7725 | error.OutOfMemory => return comp.setAllocFailure(), | 7734 | error.OutOfMemory => return comp.setAllocFailure(), |
| 7726 | }; | 7735 | }; |