diff options
| author | Jakub Konka <kubkon@jakubkonka.com> | 2021-07-22 22:19:15 +0200 |
|---|---|---|
| committer | Jakub Konka <kubkon@jakubkonka.com> | 2021-07-22 23:13:13 +0200 |
| commit | a4feb97cdfb330207f3da05402983bf3a71de64e (patch) | |
| tree | a2afbbb4567f128b4c1785c26d3a5bdb129dc9ce /src/link/MachO/Object.zig | |
| parent | 4fd0cb7618ffb5428981672f6a21c411599f51b2 (diff) | |
| download | zig-a4feb97cdfb330207f3da05402983bf3a71de64e.tar.gz zig-a4feb97cdfb330207f3da05402983bf3a71de64e.zip | |
macho: assign and cache section ordinals upon creation
then, when sorting sections within segments, clear and redo the
ordinals since we re-apply them to symbols anyway. It is vital
to have the ordinals consistent with parsing and resolving relocs
however.
Diffstat (limited to 'src/link/MachO/Object.zig')
| -rw-r--r-- | src/link/MachO/Object.zig | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/link/MachO/Object.zig b/src/link/MachO/Object.zig index c5ff19b9be..846b87a65a 100644 --- a/src/link/MachO/Object.zig +++ b/src/link/MachO/Object.zig @@ -733,7 +733,7 @@ pub fn parseTextBlocks(self: *Object, macho_file: *MachO) !void { try macho_file.locals.append(macho_file.base.allocator, .{ .n_strx = try macho_file.makeString(sym_name), .n_type = macho.N_SECT, - .n_sect = macho_file.sectionId(match), + .n_sect = macho_file.section_to_ordinal.get(match) orelse unreachable, .n_desc = 0, .n_value = sect.addr, }); @@ -779,7 +779,7 @@ pub fn parseTextBlocks(self: *Object, macho_file: *MachO) !void { const nlist = nlist_with_index.nlist; const local_sym_index = self.symbol_mapping.get(nlist_with_index.index) orelse unreachable; const local = &macho_file.locals.items[local_sym_index]; - local.n_sect = macho_file.sectionId(match); + local.n_sect = macho_file.section_to_ordinal.get(match) orelse unreachable; const stab: ?TextBlock.Stab = if (self.debug_info) |di| blk: { // TODO there has to be a better to handle this. |
