From 41d3b9a3edacc7e0e903fffc5c912f7e69f30c3a Mon Sep 17 00:00:00 2001 From: Jakub Konka Date: Mon, 21 Sep 2026 00:24:24 +0200 Subject: [PATCH] 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. --- src/link/MachO.zig | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/link/MachO.zig b/src/link/MachO.zig index a1baa45e2786cb4183ee5100fbdff11e0f76eb7b..d321d45939cd883d40a3dadd32462071b442fe67 100644 --- a/src/link/MachO.zig +++ b/src/link/MachO.zig @@ -466,7 +466,19 @@ pub fn flush( self.classifyInputFile(archive_input) catch |err| diags.addParseError(lib.path, "failed to parse input file: {s}", .{@errorName(err)}); }, - else => unreachable, + else => { + dso: { + const dso_input = link.openDsoInput(io, diags, lib.path, lib.needed, lib.weak, lib.reexport) catch break :dso; + self.classifyInputFile(dso_input) catch break :dso; + continue; + } + ar: { + const archive_input = link.openArchiveInput(io, diags, lib.path, lib.must_link, lib.hidden) catch break :ar; + self.classifyInputFile(archive_input) catch break :ar; + continue; + } + diags.addParseError(lib.path, "unknown file extension", .{}); + }, } } -- 2.54.0