| ... | ... | @@ -1,35 +1,36 @@ |
| 1 | 1 | const MachO = @This(); |
| 2 | 2 | |
| 3 | 3 | const std = @import("std"); |
| 4 | | const Allocator = std.mem.Allocator; |
| 4 | const build_options = @import("build_options"); |
| 5 | 5 | const assert = std.debug.assert; |
| 6 | 6 | const fmt = std.fmt; |
| 7 | 7 | const fs = std.fs; |
| 8 | 8 | const log = std.log.scoped(.link); |
| 9 | 9 | const macho = std.macho; |
| 10 | | const codegen = @import("../codegen.zig"); |
| 11 | | const aarch64 = @import("../codegen/aarch64.zig"); |
| 12 | 10 | const math = std.math; |
| 13 | 11 | const mem = std.mem; |
| 14 | 12 | const meta = std.meta; |
| 15 | 13 | |
| 14 | const aarch64 = @import("../codegen/aarch64.zig"); |
| 16 | 15 | const bind = @import("MachO/bind.zig"); |
| 17 | | const trace = @import("../tracy.zig").trace; |
| 18 | | const build_options = @import("build_options"); |
| 19 | | const Module = @import("../Module.zig"); |
| 20 | | const Compilation = @import("../Compilation.zig"); |
| 16 | const codegen = @import("../codegen.zig"); |
| 17 | const commands = @import("MachO/commands.zig"); |
| 21 | 18 | const link = @import("../link.zig"); |
| 22 | | const File = link.File; |
| 23 | | const Cache = @import("../Cache.zig"); |
| 24 | 19 | const target_util = @import("../target.zig"); |
| 20 | const trace = @import("../tracy.zig").trace; |
| 25 | 21 | |
| 22 | const Allocator = mem.Allocator; |
| 23 | const Cache = @import("../Cache.zig"); |
| 24 | const CodeSignature = @import("MachO/CodeSignature.zig"); |
| 25 | const Compilation = @import("../Compilation.zig"); |
| 26 | 26 | const DebugSymbols = @import("MachO/DebugSymbols.zig"); |
| 27 | const LoadCommand = commands.LoadCommand; |
| 28 | const Module = @import("../Module.zig"); |
| 29 | const File = link.File; |
| 27 | 30 | const Trie = @import("MachO/Trie.zig"); |
| 28 | | const CodeSignature = @import("MachO/CodeSignature.zig"); |
| 31 | const SegmentCommand = commands.SegmentCommand; |
| 29 | 32 | const Zld = @import("MachO/Zld.zig"); |
| 30 | 33 | |
| 31 | | usingnamespace @import("MachO/commands.zig"); |
| 32 | | |
| 33 | 34 | pub const base_tag: File.Tag = File.Tag.macho; |
| 34 | 35 | |
| 35 | 36 | base: File, |
| ... | ... | @@ -1841,7 +1842,7 @@ pub fn populateMissingMetadata(self: *MachO) !void { |
| 1841 | 1842 | @sizeOf(macho.dylinker_command) + mem.lenZ(DEFAULT_DYLD_PATH), |
| 1842 | 1843 | @sizeOf(u64), |
| 1843 | 1844 | )); |
| 1844 | | var dylinker_cmd = emptyGenericCommandWithData(macho.dylinker_command{ |
| 1845 | var dylinker_cmd = commands.emptyGenericCommandWithData(macho.dylinker_command{ |
| 1845 | 1846 | .cmd = macho.LC_LOAD_DYLINKER, |
| 1846 | 1847 | .cmdsize = cmdsize, |
| 1847 | 1848 | .name = @sizeOf(macho.dylinker_command), |
| ... | ... | @@ -1855,7 +1856,7 @@ pub fn populateMissingMetadata(self: *MachO) !void { |
| 1855 | 1856 | if (self.libsystem_cmd_index == null) { |
| 1856 | 1857 | self.libsystem_cmd_index = @intCast(u16, self.load_commands.items.len); |
| 1857 | 1858 | |
| 1858 | | var dylib_cmd = try createLoadDylibCommand(self.base.allocator, mem.spanZ(LIB_SYSTEM_PATH), 2, 0, 0); |
| 1859 | var dylib_cmd = try commands.createLoadDylibCommand(self.base.allocator, mem.spanZ(LIB_SYSTEM_PATH), 2, 0, 0); |
| 1859 | 1860 | errdefer dylib_cmd.deinit(self.base.allocator); |
| 1860 | 1861 | |
| 1861 | 1862 | try self.load_commands.append(self.base.allocator, .{ .Dylib = dylib_cmd }); |
| ... | ... | @@ -3105,7 +3106,7 @@ fn writeLoadCommands(self: *MachO) !void { |
| 3105 | 3106 | |
| 3106 | 3107 | /// Writes Mach-O file header. |
| 3107 | 3108 | fn writeHeader(self: *MachO) !void { |
| 3108 | | var header = emptyHeader(.{ |
| 3109 | var header = commands.emptyHeader(.{ |
| 3109 | 3110 | .flags = macho.MH_NOUNDEFS | macho.MH_DYLDLINK | macho.MH_PIE | macho.MH_TWOLEVEL, |
| 3110 | 3111 | }); |
| 3111 | 3112 | |