authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2020-12-11 21:47:10+01:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2020-12-17 10:04:53+01:00
log77e545892e316da57649268f55326e215f3491ca
tree77730c12fc6d51e0426b2021092b8b332e4439e5
parentb099fdff9374afef8921910970373ce80b804e2b

macho: do not error out on unknown load commands

Also, do not try to fixup missing libSystem for dylibs.

1 files changed, 2 insertions(+), 4 deletions(-)

src/link/MachO.zig+2-4
......@@ -755,7 +755,7 @@ fn linkWithLLD(self: *MachO, comp: *Compilation) !void {
755755 const out_file = try directory.handle.openFile(self.base.options.emit.?.sub_path, .{ .write = true });
756756 try self.parseFromFile(out_file);
757757
758 if (self.libsystem_cmd_index == null) {
758 if (self.libsystem_cmd_index == null and self.header.?.filetype == macho.MH_EXECUTE) {
759759 const text_segment = self.load_commands.items[self.text_segment_cmd_index.?].Segment;
760760 const text_section = text_segment.sections.items[self.text_section_index.?];
761761 const after_last_cmd_offset = self.header.?.sizeofcmds + @sizeOf(macho.mach_header_64);
......@@ -2039,10 +2039,8 @@ fn parseFromFile(self: *MachO, file: fs.File) !void {
20392039 macho.LC_CODE_SIGNATURE => {
20402040 self.code_signature_cmd_index = i;
20412041 },
2042 // TODO populate more MachO fields
20432042 else => {
2044 std.log.err("Unknown load command detected: 0x{x}.", .{cmd.cmd()});
2045 return error.UnknownLoadCommand;
2043 std.log.warn("Unknown load command detected: 0x{x}.", .{cmd.cmd()});
20462044 },
20472045 }
20482046 self.load_commands.appendAssumeCapacity(cmd);