| ... | ... | @@ -4012,27 +4012,8 @@ fn placeDecl(self: *MachO, decl: *Module.Decl, code_len: usize) !*macho.nlist_64 |
| 4012 | 4012 | |
| 4013 | 4013 | if (need_realloc) { |
| 4014 | 4014 | const vaddr = try self.growAtom(&decl.link.macho, code_len, required_alignment, match); |
| 4015 | | |
| 4016 | 4015 | log.debug("growing {s} and moving from 0x{x} to 0x{x}", .{ sym_name, symbol.n_value, vaddr }); |
| 4017 | 4016 | log.debug(" (required alignment 0x{x})", .{required_alignment}); |
| 4018 | | |
| 4019 | | if (vaddr != symbol.n_value) { |
| 4020 | | log.debug(" (writing new GOT entry)", .{}); |
| 4021 | | const got_index = self.got_entries_table.get(.{ .local = decl.link.macho.local_sym_index }).?; |
| 4022 | | const got_atom = self.got_entries.items[got_index].atom; |
| 4023 | | const got_sym = &self.locals.items[got_atom.local_sym_index]; |
| 4024 | | const got_vaddr = try self.allocateAtom(got_atom, @sizeOf(u64), 8, .{ |
| 4025 | | .seg = self.data_const_segment_cmd_index.?, |
| 4026 | | .sect = self.got_section_index.?, |
| 4027 | | }); |
| 4028 | | got_sym.n_value = got_vaddr; |
| 4029 | | got_sym.n_sect = @intCast(u8, self.section_ordinals.getIndex(.{ |
| 4030 | | .seg = self.data_const_segment_cmd_index.?, |
| 4031 | | .sect = self.got_section_index.?, |
| 4032 | | }).? + 1); |
| 4033 | | got_atom.dirty = true; |
| 4034 | | } |
| 4035 | | |
| 4036 | 4017 | symbol.n_value = vaddr; |
| 4037 | 4018 | } else if (code_len < decl.link.macho.size) { |
| 4038 | 4019 | self.shrinkAtom(&decl.link.macho, code_len, match); |