| author | |
| committer | |
| log | 054fe96bcd84cc4f0536696636531b192224df48 |
| tree | 05382c88920cf92f7eda0b6c3814c68263a3df67 |
| parent | 31dcb0dde71e7c6968a9ee902782783b139c4900 |
3 files changed, 23 insertions(+), 0 deletions(-)
src/link/MachO.zig+9| ... | @@ -2579,6 +2579,9 @@ fn resolveDyldStubBinder(self: *MachO) !void { | ... | @@ -2579,6 +2579,9 @@ fn resolveDyldStubBinder(self: *MachO) !void { |
| 2579 | } | 2579 | } |
| 2580 | 2580 | ||
| 2581 | fn parseObjectsIntoAtoms(self: *MachO) !void { | 2581 | fn parseObjectsIntoAtoms(self: *MachO) !void { |
| 2582 | const tracy = trace(@src()); | ||
| 2583 | defer tracy.end(); | ||
| 2584 | |||
| 2582 | var parsed_atoms = Object.ParsedAtoms.init(self.base.allocator); | 2585 | var parsed_atoms = Object.ParsedAtoms.init(self.base.allocator); |
| 2583 | defer parsed_atoms.deinit(); | 2586 | defer parsed_atoms.deinit(); |
| 2584 | 2587 | ||
| ... | @@ -3933,6 +3936,9 @@ fn findFreeSpace(self: MachO, segment_id: u16, alignment: u64, start: ?u64) u64 | ... | @@ -3933,6 +3936,9 @@ fn findFreeSpace(self: MachO, segment_id: u16, alignment: u64, start: ?u64) u64 |
| 3933 | } | 3936 | } |
| 3934 | 3937 | ||
| 3935 | fn growSection(self: *MachO, match: MatchingSection, new_size: u32) !void { | 3938 | fn growSection(self: *MachO, match: MatchingSection, new_size: u32) !void { |
| 3939 | const tracy = trace(@src()); | ||
| 3940 | defer tracy.end(); | ||
| 3941 | |||
| 3936 | const seg = &self.load_commands.items[match.seg].Segment; | 3942 | const seg = &self.load_commands.items[match.seg].Segment; |
| 3937 | const sect = &seg.sections.items[match.sect]; | 3943 | const sect = &seg.sections.items[match.sect]; |
| 3938 | 3944 | ||
| ... | @@ -4081,6 +4087,9 @@ fn getSectionMaxAlignment(self: *MachO, segment_id: u16, start_sect_id: u16) !u3 | ... | @@ -4081,6 +4087,9 @@ fn getSectionMaxAlignment(self: *MachO, segment_id: u16, start_sect_id: u16) !u3 |
| 4081 | } | 4087 | } |
| 4082 | 4088 | ||
| 4083 | fn allocateAtom(self: *MachO, atom: *Atom, new_atom_size: u64, alignment: u64, match: MatchingSection) !u64 { | 4089 | fn allocateAtom(self: *MachO, atom: *Atom, new_atom_size: u64, alignment: u64, match: MatchingSection) !u64 { |
| 4090 | const tracy = trace(@src()); | ||
| 4091 | defer tracy.end(); | ||
| 4092 | |||
| 4084 | const seg = &self.load_commands.items[match.seg].Segment; | 4093 | const seg = &self.load_commands.items[match.seg].Segment; |
| 4085 | const sect = &seg.sections.items[match.sect]; | 4094 | const sect = &seg.sections.items[match.sect]; |
| 4086 | var free_list = self.atom_free_lists.get(match).?; | 4095 | var free_list = self.atom_free_lists.get(match).?; |
src/link/MachO/Atom.zig+7| ... | @@ -10,6 +10,7 @@ const macho = std.macho; | ... | @@ -10,6 +10,7 @@ const macho = std.macho; |
| 10 | const math = std.math; | 10 | const math = std.math; |
| 11 | const mem = std.mem; | 11 | const mem = std.mem; |
| 12 | const meta = std.meta; | 12 | const meta = std.meta; |
| 13 | const trace = @import("../../tracy.zig").trace; | ||
| 13 | 14 | ||
| 14 | const Allocator = mem.Allocator; | 15 | const Allocator = mem.Allocator; |
| 15 | const Arch = std.Target.Cpu.Arch; | 16 | const Arch = std.Target.Cpu.Arch; |
| ... | @@ -701,6 +702,9 @@ fn initRelocFromObject(rel: macho.relocation_info, context: RelocContext) !Reloc | ... | @@ -701,6 +702,9 @@ fn initRelocFromObject(rel: macho.relocation_info, context: RelocContext) !Reloc |
| 701 | } | 702 | } |
| 702 | 703 | ||
| 703 | pub fn parseRelocs(self: *Atom, relocs: []macho.relocation_info, context: RelocContext) !void { | 704 | pub fn parseRelocs(self: *Atom, relocs: []macho.relocation_info, context: RelocContext) !void { |
| 705 | const tracy = trace(@src()); | ||
| 706 | defer tracy.end(); | ||
| 707 | |||
| 704 | const filtered_relocs = filterRelocs(relocs, context.base_offset, context.base_offset + self.size); | 708 | const filtered_relocs = filterRelocs(relocs, context.base_offset, context.base_offset + self.size); |
| 705 | var it = RelocIterator{ | 709 | var it = RelocIterator{ |
| 706 | .buffer = filtered_relocs, | 710 | .buffer = filtered_relocs, |
| ... | @@ -1141,6 +1145,9 @@ fn parseLoad(self: Atom, rel: macho.relocation_info, out: *Relocation) void { | ... | @@ -1141,6 +1145,9 @@ fn parseLoad(self: Atom, rel: macho.relocation_info, out: *Relocation) void { |
| 1141 | } | 1145 | } |
| 1142 | 1146 | ||
| 1143 | pub fn resolveRelocs(self: *Atom, macho_file: *MachO) !void { | 1147 | pub fn resolveRelocs(self: *Atom, macho_file: *MachO) !void { |
| 1148 | const tracy = trace(@src()); | ||
| 1149 | defer tracy.end(); | ||
| 1150 | |||
| 1144 | for (self.relocs.items) |rel| { | 1151 | for (self.relocs.items) |rel| { |
| 1145 | log.debug("relocating {}", .{rel}); | 1152 | log.debug("relocating {}", .{rel}); |
| 1146 | 1153 |
src/link/MachO/Object.zig+7| ... | @@ -14,6 +14,7 @@ const sort = std.sort; | ... | @@ -14,6 +14,7 @@ const sort = std.sort; |
| 14 | const commands = @import("commands.zig"); | 14 | const commands = @import("commands.zig"); |
| 15 | const segmentName = commands.segmentName; | 15 | const segmentName = commands.segmentName; |
| 16 | const sectionName = commands.sectionName; | 16 | const sectionName = commands.sectionName; |
| 17 | const trace = @import("../../tracy.zig").trace; | ||
| 17 | 18 | ||
| 18 | const Allocator = mem.Allocator; | 19 | const Allocator = mem.Allocator; |
| 19 | const Atom = @import("Atom.zig"); | 20 | const Atom = @import("Atom.zig"); |
| ... | @@ -344,6 +345,9 @@ const AtomParser = struct { | ... | @@ -344,6 +345,9 @@ const AtomParser = struct { |
| 344 | pub fn next(self: *AtomParser, context: Context) !?*Atom { | 345 | pub fn next(self: *AtomParser, context: Context) !?*Atom { |
| 345 | if (self.index == self.nlists.len) return null; | 346 | if (self.index == self.nlists.len) return null; |
| 346 | 347 | ||
| 348 | const tracy = trace(@src()); | ||
| 349 | defer tracy.end(); | ||
| 350 | |||
| 347 | var aliases = std.ArrayList(NlistWithIndex).init(context.allocator); | 351 | var aliases = std.ArrayList(NlistWithIndex).init(context.allocator); |
| 348 | defer aliases.deinit(); | 352 | defer aliases.deinit(); |
| 349 | 353 | ||
| ... | @@ -465,6 +469,9 @@ pub fn parseIntoAtoms( | ... | @@ -465,6 +469,9 @@ pub fn parseIntoAtoms( |
| 465 | object_id: u16, | 469 | object_id: u16, |
| 466 | macho_file: *MachO, | 470 | macho_file: *MachO, |
| 467 | ) !ParsedAtoms { | 471 | ) !ParsedAtoms { |
| 472 | const tracy = trace(@src()); | ||
| 473 | defer tracy.end(); | ||
| 474 | |||
| 468 | var parsed_atoms = ParsedAtoms.init(allocator); | 475 | var parsed_atoms = ParsedAtoms.init(allocator); |
| 469 | const seg = self.load_commands.items[self.segment_cmd_index.?].Segment; | 476 | const seg = self.load_commands.items[self.segment_cmd_index.?].Segment; |
| 470 | 477 |