Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

link: mark prelink tasks as procesed under -fno-emit-bin #23255

Merged
merged 1 commit into from
Mar 23, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions src/link.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1457,8 +1457,10 @@ pub const Task = union(enum) {
pub fn doTask(comp: *Compilation, tid: usize, task: Task) void {
const diags = &comp.link_diags;
switch (task) {
.load_explicitly_provided => if (comp.bin_file) |base| {
.load_explicitly_provided => {
comp.remaining_prelink_tasks -= 1;
const base = comp.bin_file orelse return;

const prog_node = comp.work_queue_progress_node.start("Parse Linker Inputs", comp.link_inputs.len);
defer prog_node.end();
for (comp.link_inputs) |input| {
Expand All @@ -1475,8 +1477,10 @@ pub fn doTask(comp: *Compilation, tid: usize, task: Task) void {
prog_node.completeOne();
}
},
.load_host_libc => if (comp.bin_file) |base| {
.load_host_libc => {
comp.remaining_prelink_tasks -= 1;
const base = comp.bin_file orelse return;

const prog_node = comp.work_queue_progress_node.start("Linker Parse Host libc", 0);
defer prog_node.end();

Expand Down Expand Up @@ -1535,26 +1539,29 @@ pub fn doTask(comp: *Compilation, tid: usize, task: Task) void {
}
}
},
.load_object => |path| if (comp.bin_file) |base| {
.load_object => |path| {
comp.remaining_prelink_tasks -= 1;
const base = comp.bin_file orelse return;
const prog_node = comp.work_queue_progress_node.start("Linker Parse Object", 0);
defer prog_node.end();
base.openLoadObject(path) catch |err| switch (err) {
error.LinkFailure => return, // error reported via diags
else => |e| diags.addParseError(path, "failed to parse object: {s}", .{@errorName(e)}),
};
},
.load_archive => |path| if (comp.bin_file) |base| {
.load_archive => |path| {
comp.remaining_prelink_tasks -= 1;
const base = comp.bin_file orelse return;
const prog_node = comp.work_queue_progress_node.start("Linker Parse Archive", 0);
defer prog_node.end();
base.openLoadArchive(path, null) catch |err| switch (err) {
error.LinkFailure => return, // error reported via link_diags
else => |e| diags.addParseError(path, "failed to parse archive: {s}", .{@errorName(e)}),
};
},
.load_dso => |path| if (comp.bin_file) |base| {
.load_dso => |path| {
comp.remaining_prelink_tasks -= 1;
const base = comp.bin_file orelse return;
const prog_node = comp.work_queue_progress_node.start("Linker Parse Shared Library", 0);
defer prog_node.end();
base.openLoadDso(path, .{
Expand All @@ -1565,8 +1572,9 @@ pub fn doTask(comp: *Compilation, tid: usize, task: Task) void {
else => |e| diags.addParseError(path, "failed to parse shared library: {s}", .{@errorName(e)}),
};
},
.load_input => |input| if (comp.bin_file) |base| {
.load_input => |input| {
comp.remaining_prelink_tasks -= 1;
const base = comp.bin_file orelse return;
const prog_node = comp.work_queue_progress_node.start("Linker Parse Input", 0);
defer prog_node.end();
base.loadInput(input) catch |err| switch (err) {
Expand Down
Loading