authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2021-07-18 15:39:01+02:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2021-07-18 15:39:01+02:00
loge0b53ad3c99b8f38d2fdba7b9aa6bf3e638dbeb9
tree37698b271310e0f1f63a531f9e00706a9f5aefa1
parent2828cd2983446b116dc8d543ca5e209e361f39d0

macho: clean up imports


1 files changed, 16 insertions(+), 15 deletions(-)

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