| ... | ... | @@ -1365,11 +1365,11 @@ pub const File = struct { |
| 1365 | 1365 | /// from the rest of compilation. All tasks performed here are |
| 1366 | 1366 | /// single-threaded with respect to one another. |
| 1367 | 1367 | pub fn flushTaskQueue(tid: usize, comp: *Compilation) void { |
| 1368 | | comp.link_task_queue_safety.lock(); |
| 1369 | | defer comp.link_task_queue_safety.unlock(); |
| 1370 | | const prog_node = comp.work_queue_progress_node.start("Parse Linker Inputs", 0); |
| 1371 | | defer prog_node.end(); |
| 1368 | // As soon as check() is called, another `flushTaskQueue` call could occur, |
| 1369 | // so the safety lock must go after the check. |
| 1372 | 1370 | while (comp.link_task_queue.check()) |tasks| { |
| 1371 | comp.link_task_queue_safety.lock(); |
| 1372 | defer comp.link_task_queue_safety.unlock(); |
| 1373 | 1373 | for (tasks) |task| doTask(comp, tid, task); |
| 1374 | 1374 | } |
| 1375 | 1375 | } |
| ... | ... | @@ -1412,6 +1412,8 @@ pub fn doTask(comp: *Compilation, tid: usize, task: Task) void { |
| 1412 | 1412 | const diags = &comp.link_diags; |
| 1413 | 1413 | switch (task) { |
| 1414 | 1414 | .load_explicitly_provided => if (comp.bin_file) |base| { |
| 1415 | const prog_node = comp.work_queue_progress_node.start("Parse Linker Inputs", comp.link_inputs.len); |
| 1416 | defer prog_node.end(); |
| 1415 | 1417 | for (comp.link_inputs) |input| { |
| 1416 | 1418 | base.loadInput(input) catch |err| switch (err) { |
| 1417 | 1419 | error.LinkFailure => return, // error reported via diags |
| ... | ... | @@ -1423,9 +1425,13 @@ pub fn doTask(comp: *Compilation, tid: usize, task: Task) void { |
| 1423 | 1425 | .dso_exact => diags.addError("failed to handle dso_exact: {s}", .{@errorName(e)}), |
| 1424 | 1426 | }, |
| 1425 | 1427 | }; |
| 1428 | prog_node.completeOne(); |
| 1426 | 1429 | } |
| 1427 | 1430 | }, |
| 1428 | 1431 | .load_host_libc => if (comp.bin_file) |base| { |
| 1432 | const prog_node = comp.work_queue_progress_node.start("Linker Parse Host libc", 0); |
| 1433 | defer prog_node.end(); |
| 1434 | |
| 1429 | 1435 | const target = comp.root_mod.resolved_target.result; |
| 1430 | 1436 | const flags = target_util.libcFullLinkFlags(target); |
| 1431 | 1437 | const crt_dir = comp.libc_installation.?.crt_dir.?; |
| ... | ... | @@ -1482,18 +1488,24 @@ pub fn doTask(comp: *Compilation, tid: usize, task: Task) void { |
| 1482 | 1488 | } |
| 1483 | 1489 | }, |
| 1484 | 1490 | .load_object => |path| if (comp.bin_file) |base| { |
| 1491 | const prog_node = comp.work_queue_progress_node.start("Linker Parse Object", 0); |
| 1492 | defer prog_node.end(); |
| 1485 | 1493 | base.openLoadObject(path) catch |err| switch (err) { |
| 1486 | 1494 | error.LinkFailure => return, // error reported via diags |
| 1487 | 1495 | else => |e| diags.addParseError(path, "failed to parse object: {s}", .{@errorName(e)}), |
| 1488 | 1496 | }; |
| 1489 | 1497 | }, |
| 1490 | 1498 | .load_archive => |path| if (comp.bin_file) |base| { |
| 1499 | const prog_node = comp.work_queue_progress_node.start("Linker Parse Archive", 0); |
| 1500 | defer prog_node.end(); |
| 1491 | 1501 | base.openLoadArchive(path, null) catch |err| switch (err) { |
| 1492 | 1502 | error.LinkFailure => return, // error reported via link_diags |
| 1493 | 1503 | else => |e| diags.addParseError(path, "failed to parse archive: {s}", .{@errorName(e)}), |
| 1494 | 1504 | }; |
| 1495 | 1505 | }, |
| 1496 | 1506 | .load_dso => |path| if (comp.bin_file) |base| { |
| 1507 | const prog_node = comp.work_queue_progress_node.start("Linker Parse Shared Library", 0); |
| 1508 | defer prog_node.end(); |
| 1497 | 1509 | base.openLoadDso(path, .{ |
| 1498 | 1510 | .preferred_mode = .dynamic, |
| 1499 | 1511 | .search_strategy = .paths_first, |
| ... | ... | @@ -1503,6 +1515,8 @@ pub fn doTask(comp: *Compilation, tid: usize, task: Task) void { |
| 1503 | 1515 | }; |
| 1504 | 1516 | }, |
| 1505 | 1517 | .load_input => |input| if (comp.bin_file) |base| { |
| 1518 | const prog_node = comp.work_queue_progress_node.start("Linker Parse Input", 0); |
| 1519 | defer prog_node.end(); |
| 1506 | 1520 | base.loadInput(input) catch |err| switch (err) { |
| 1507 | 1521 | error.LinkFailure => return, // error reported via link_diags |
| 1508 | 1522 | else => |e| { |