authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-10-16 14:38:46-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-10-23 16:27:38-07:00
logcbcd67ea90979eca4a2b46838c54472058886fed
tree0b6db2084dc256dc2c58151803131e2db395004e
parent65d42086ffbd6d7dea2b9a43b97bfc1e437f8a82

link.MachO: fix missing input classification


2 files changed, 16 insertions(+), 6 deletions(-)

src/link.zig+2-2
......@@ -1997,8 +1997,8 @@ pub fn openObjectInput(diags: *Diags, path: Path) error{LinkFailure}!Input {
19971997 } };
19981998}
19991999
2000pub fn openArchiveInput(diags: *Diags, path: Path) error{LinkFailure}!Input {
2001 return .{ .archive = openObject(path, false, false) catch |err| {
2000pub fn openArchiveInput(diags: *Diags, path: Path, must_link: bool, hidden: bool) error{LinkFailure}!Input {
2001 return .{ .archive = openObject(path, must_link, hidden) catch |err| {
20022002 return diags.failParse(path, "failed to open {}: {s}", .{ path, @errorName(err) });
20032003 } };
20042004}
src/link/MachO.zig+14-4
......@@ -447,15 +447,25 @@ pub fn flushModule(self: *MachO, arena: Allocator, tid: Zcu.PerThread.Id, prog_n
447447 };
448448
449449 for (system_libs.items) |lib| {
450 const dso_input = try link.openDsoInput(diags, lib.path, lib.needed, lib.weak, lib.reexport);
451 self.classifyInputFile(dso_input) catch |err|
452 diags.addParseError(lib.path, "failed to parse input file: {s}", .{@errorName(err)});
450 switch (Compilation.classifyFileExt(lib.path.sub_path)) {
451 .shared_library => {
452 const dso_input = try link.openDsoInput(diags, lib.path, lib.needed, lib.weak, lib.reexport);
453 self.classifyInputFile(dso_input) catch |err|
454 diags.addParseError(lib.path, "failed to parse input file: {s}", .{@errorName(err)});
455 },
456 .static_library => {
457 const archive_input = try link.openArchiveInput(diags, lib.path, lib.must_link, lib.hidden);
458 self.classifyInputFile(archive_input) catch |err|
459 diags.addParseError(lib.path, "failed to parse input file: {s}", .{@errorName(err)});
460 },
461 else => unreachable,
462 }
453463 }
454464
455465 // Finally, link against compiler_rt.
456466 if (comp.compiler_rt_lib) |crt_file| {
457467 const path = crt_file.full_object_path;
458 self.classifyInputFile(try link.openArchiveInput(diags, path)) catch |err|
468 self.classifyInputFile(try link.openArchiveInput(diags, path, false, false)) catch |err|
459469 diags.addParseError(path, "failed to parse archive: {s}", .{@errorName(err)});
460470 } else if (comp.compiler_rt_obj) |crt_file| {
461471 const path = crt_file.full_object_path;