aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJakub Konka <kubkon@jakubkonka.com>2020-12-11 21:47:10 +0100
committerJakub Konka <kubkon@jakubkonka.com>2020-12-17 10:04:53 +0100
commit77e545892e316da57649268f55326e215f3491ca (patch)
tree77730c12fc6d51e0426b2021092b8b332e4439e5 /src
parentb099fdff9374afef8921910970373ce80b804e2b (diff)
downloadzig-77e545892e316da57649268f55326e215f3491ca.tar.gz
zig-77e545892e316da57649268f55326e215f3491ca.zip
macho: do not error out on unknown load commands
Also, do not try to fixup missing libSystem for dylibs.
Diffstat (limited to 'src')
-rw-r--r--src/link/MachO.zig6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/link/MachO.zig b/src/link/MachO.zig
index fc96466e1e..6db725ddec 100644
--- a/src/link/MachO.zig
+++ b/src/link/MachO.zig
@@ -755,7 +755,7 @@ fn linkWithLLD(self: *MachO, comp: *Compilation) !void {
const out_file = try directory.handle.openFile(self.base.options.emit.?.sub_path, .{ .write = true });
try self.parseFromFile(out_file);
- if (self.libsystem_cmd_index == null) {
+ if (self.libsystem_cmd_index == null and self.header.?.filetype == macho.MH_EXECUTE) {
const text_segment = self.load_commands.items[self.text_segment_cmd_index.?].Segment;
const text_section = text_segment.sections.items[self.text_section_index.?];
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 {
macho.LC_CODE_SIGNATURE => {
self.code_signature_cmd_index = i;
},
- // TODO populate more MachO fields
else => {
- std.log.err("Unknown load command detected: 0x{x}.", .{cmd.cmd()});
- return error.UnknownLoadCommand;
+ std.log.warn("Unknown load command detected: 0x{x}.", .{cmd.cmd()});
},
}
self.load_commands.appendAssumeCapacity(cmd);