| ... | @@ -2230,13 +2230,6 @@ fn allocateLocals(self: *MachO) !void { | ... | @@ -2230,13 +2230,6 @@ fn allocateLocals(self: *MachO) !void { |
| 2230 | base_vaddr, | 2230 | base_vaddr, |
| 2231 | }); | 2231 | }); |
| 2232 | | 2232 | |
| 2233 | // Update each alias (if any) | | |
| 2234 | for (atom.aliases.items) |index| { | | |
| 2235 | const alias_sym = &self.locals.items[index]; | | |
| 2236 | alias_sym.n_value = base_vaddr; | | |
| 2237 | alias_sym.n_sect = n_sect; | | |
| 2238 | } | | |
| 2239 | | | |
| 2240 | // Update each symbol contained within the atom | 2233 | // Update each symbol contained within the atom |
| 2241 | for (atom.contained.items) |sym_at_off| { | 2234 | for (atom.contained.items) |sym_at_off| { |
| 2242 | const contained_sym = &self.locals.items[sym_at_off.local_sym_index]; | 2235 | const contained_sym = &self.locals.items[sym_at_off.local_sym_index]; |
| ... | @@ -2260,11 +2253,6 @@ fn shiftLocalsByOffset(self: *MachO, match: MatchingSection, offset: i64) !void | ... | @@ -2260,11 +2253,6 @@ fn shiftLocalsByOffset(self: *MachO, match: MatchingSection, offset: i64) !void |
| 2260 | const atom_sym = &self.locals.items[atom.local_sym_index]; | 2253 | const atom_sym = &self.locals.items[atom.local_sym_index]; |
| 2261 | atom_sym.n_value = @intCast(u64, @intCast(i64, atom_sym.n_value) + offset); | 2254 | atom_sym.n_value = @intCast(u64, @intCast(i64, atom_sym.n_value) + offset); |
| 2262 | | 2255 | |
| 2263 | for (atom.aliases.items) |index| { | | |
| 2264 | const alias_sym = &self.locals.items[index]; | | |
| 2265 | alias_sym.n_value = @intCast(u64, @intCast(i64, alias_sym.n_value) + offset); | | |
| 2266 | } | | |
| 2267 | | | |
| 2268 | for (atom.contained.items) |sym_at_off| { | 2256 | for (atom.contained.items) |sym_at_off| { |
| 2269 | const contained_sym = &self.locals.items[sym_at_off.local_sym_index]; | 2257 | const contained_sym = &self.locals.items[sym_at_off.local_sym_index]; |
| 2270 | contained_sym.n_value = @intCast(u64, @intCast(i64, contained_sym.n_value) + offset); | 2258 | contained_sym.n_value = @intCast(u64, @intCast(i64, contained_sym.n_value) + offset); |
| ... | @@ -3463,13 +3451,6 @@ fn parseObjectsIntoAtoms(self: *MachO) !void { | ... | @@ -3463,13 +3451,6 @@ fn parseObjectsIntoAtoms(self: *MachO) !void { |
| 3463 | atom.alignment, | 3451 | atom.alignment, |
| 3464 | }); | 3452 | }); |
| 3465 | | 3453 | |
| 3466 | // Update each alias (if any) | | |
| 3467 | for (atom.aliases.items) |index| { | | |
| 3468 | const alias_sym = &self.locals.items[index]; | | |
| 3469 | alias_sym.n_value = base_vaddr; | | |
| 3470 | alias_sym.n_sect = n_sect; | | |
| 3471 | } | | |
| 3472 | | | |
| 3473 | // Update each symbol contained within the atom | 3454 | // Update each symbol contained within the atom |
| 3474 | for (atom.contained.items) |sym_at_off| { | 3455 | for (atom.contained.items) |sym_at_off| { |
| 3475 | const contained_sym = &self.locals.items[sym_at_off.local_sym_index]; | 3456 | const contained_sym = &self.locals.items[sym_at_off.local_sym_index]; |
| ... | @@ -6463,17 +6444,11 @@ fn writeSymbolTable(self: *MachO) !void { | ... | @@ -6463,17 +6444,11 @@ fn writeSymbolTable(self: *MachO) !void { |
| 6463 | }); | 6444 | }); |
| 6464 | | 6445 | |
| 6465 | for (object.contained_atoms.items) |atom| { | 6446 | for (object.contained_atoms.items) |atom| { |
| 6466 | if (atom.stab) |stab| { | 6447 | for (atom.contained.items) |sym_at_off| { |
| 6467 | const nlists = try stab.asNlists(atom.local_sym_index, self); | 6448 | const stab = sym_at_off.stab orelse continue; |
| | 6449 | const nlists = try stab.asNlists(sym_at_off.local_sym_index, self); |
| 6468 | defer self.base.allocator.free(nlists); | 6450 | defer self.base.allocator.free(nlists); |
| 6469 | try locals.appendSlice(nlists); | 6451 | try locals.appendSlice(nlists); |
| 6470 | } else { | | |
| 6471 | for (atom.contained.items) |sym_at_off| { | | |
| 6472 | const stab = sym_at_off.stab orelse continue; | | |
| 6473 | const nlists = try stab.asNlists(sym_at_off.local_sym_index, self); | | |
| 6474 | defer self.base.allocator.free(nlists); | | |
| 6475 | try locals.appendSlice(nlists); | | |
| 6476 | } | | |
| 6477 | } | 6452 | } |
| 6478 | } | 6453 | } |
| 6479 | | 6454 | |
| ... | @@ -6929,8 +6904,10 @@ fn snapshotState(self: *MachO) !void { | ... | @@ -6929,8 +6904,10 @@ fn snapshotState(self: *MachO) !void { |
| 6929 | }; | 6904 | }; |
| 6930 | | 6905 | |
| 6931 | var aliases = std.ArrayList([]const u8).init(arena); | 6906 | var aliases = std.ArrayList([]const u8).init(arena); |
| 6932 | for (atom.aliases.items) |loc| { | 6907 | for (atom.contained.items) |sym_off| { |
| 6933 | try aliases.append(self.getString(self.locals.items[loc].n_strx)); | 6908 | if (sym_off.offset == 0) { |
| | 6909 | try aliases.append(self.getString(self.locals.items[sym_off.local_sym_index].n_strx)); |
| | 6910 | } |
| 6934 | } | 6911 | } |
| 6935 | node.payload.aliases = aliases.toOwnedSlice(); | 6912 | node.payload.aliases = aliases.toOwnedSlice(); |
| 6936 | try nodes.append(node); | 6913 | try nodes.append(node); |