authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2026-09-21 00:24:24+02:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-09-22 06:38:36+02:00
log41d3b9a3edacc7e0e903fffc5c912f7e69f30c3a
tree0c4d774eb4a8335e6e92481ed6c57e8f127da7b2
parente3381ce10ee1ffec2ab7b82dd1b87a5aedaeef97

MachO: handle dylibs/archives not classified via extension

Frameworks internally are just dylibs but it is not uncommon for them not to have an extension such `.dylib` or `.tbd`. Same may apply to archive files. For that reason, if we fail to classify by extension, do not give up yet, try parsing as dylib or archive, and then flag as a user error rather than panic.

1 files changed, 13 insertions(+), 1 deletions(-)

src/link/MachO.zig+13-1
......@@ -466,7 +466,19 @@ pub fn flush(
466466 self.classifyInputFile(archive_input) catch |err|
467467 diags.addParseError(lib.path, "failed to parse input file: {s}", .{@errorName(err)});
468468 },
469 else => unreachable,
469 else => {
470 dso: {
471 const dso_input = link.openDsoInput(io, diags, lib.path, lib.needed, lib.weak, lib.reexport) catch break :dso;
472 self.classifyInputFile(dso_input) catch break :dso;
473 continue;
474 }
475 ar: {
476 const archive_input = link.openArchiveInput(io, diags, lib.path, lib.must_link, lib.hidden) catch break :ar;
477 self.classifyInputFile(archive_input) catch break :ar;
478 continue;
479 }
480 diags.addParseError(lib.path, "unknown file extension", .{});
481 },
470482 }
471483 }
472484