| ... | @@ -137,7 +137,6 @@ fn allocateSection(self: *DebugSymbols, sectname: []const u8, size: u64, alignme | ... | @@ -137,7 +137,6 @@ fn allocateSection(self: *DebugSymbols, sectname: []const u8, size: u64, alignme |
| 137 | off + size, | 137 | off + size, |
| 138 | }); | 138 | }); |
| 139 | | 139 | |
| 140 | sect.addr = segment.vmaddr + off - segment.fileoff; | | |
| 141 | sect.offset = @intCast(u32, off); | 140 | sect.offset = @intCast(u32, off); |
| 142 | | 141 | |
| 143 | const index = @intCast(u8, self.sections.items.len); | 142 | const index = @intCast(u8, self.sections.items.len); |
| ... | @@ -152,11 +151,13 @@ pub fn growSection(self: *DebugSymbols, sect_index: u8, needed_size: u32) !void | ... | @@ -152,11 +151,13 @@ pub fn growSection(self: *DebugSymbols, sect_index: u8, needed_size: u32) !void |
| 152 | const sect = self.getSectionPtr(sect_index); | 151 | const sect = self.getSectionPtr(sect_index); |
| 153 | | 152 | |
| 154 | if (needed_size > self.allocatedSize(sect.offset)) { | 153 | if (needed_size > self.allocatedSize(sect.offset)) { |
| | 154 | const existing_size = sect.size; |
| | 155 | sect.size = 0; // free the space |
| 155 | const new_offset = self.findFreeSpace(needed_size, 1); | 156 | const new_offset = self.findFreeSpace(needed_size, 1); |
| 156 | | 157 | |
| 157 | log.debug("moving {s} section: {} bytes from 0x{x} to 0x{x}", .{ | 158 | log.debug("moving {s} section: {} bytes from 0x{x} to 0x{x}", .{ |
| 158 | sect.sectName(), | 159 | sect.sectName(), |
| 159 | sect.size, | 160 | existing_size, |
| 160 | sect.offset, | 161 | sect.offset, |
| 161 | new_offset, | 162 | new_offset, |
| 162 | }); | 163 | }); |
| ... | @@ -165,9 +166,9 @@ pub fn growSection(self: *DebugSymbols, sect_index: u8, needed_size: u32) !void | ... | @@ -165,9 +166,9 @@ pub fn growSection(self: *DebugSymbols, sect_index: u8, needed_size: u32) !void |
| 165 | sect.offset, | 166 | sect.offset, |
| 166 | self.file, | 167 | self.file, |
| 167 | new_offset, | 168 | new_offset, |
| 168 | sect.size, | 169 | existing_size, |
| 169 | ); | 170 | ); |
| 170 | if (amt != sect.size) return error.InputOutput; | 171 | if (amt != existing_size) return error.InputOutput; |
| 171 | sect.offset = @intCast(u32, new_offset); | 172 | sect.offset = @intCast(u32, new_offset); |
| 172 | } | 173 | } |
| 173 | sect.size = needed_size; | 174 | sect.size = needed_size; |
| ... | @@ -275,7 +276,6 @@ pub fn flushModule(self: *DebugSymbols, macho_file: *MachO) !void { | ... | @@ -275,7 +276,6 @@ pub fn flushModule(self: *DebugSymbols, macho_file: *MachO) !void { |
| 275 | } | 276 | } |
| 276 | | 277 | |
| 277 | { | 278 | { |
| 278 | const dwarf_segment = self.getDwarfSegmentPtr(); | | |
| 279 | const debug_strtab_sect = &self.sections.items[self.debug_str_section_index.?]; | 279 | const debug_strtab_sect = &self.sections.items[self.debug_str_section_index.?]; |
| 280 | if (self.debug_string_table_dirty or self.dwarf.strtab.items.len != debug_strtab_sect.size) { | 280 | if (self.debug_string_table_dirty or self.dwarf.strtab.items.len != debug_strtab_sect.size) { |
| 281 | const allocated_size = self.allocatedSize(debug_strtab_sect.offset); | 281 | const allocated_size = self.allocatedSize(debug_strtab_sect.offset); |
| ... | @@ -284,7 +284,6 @@ pub fn flushModule(self: *DebugSymbols, macho_file: *MachO) !void { | ... | @@ -284,7 +284,6 @@ pub fn flushModule(self: *DebugSymbols, macho_file: *MachO) !void { |
| 284 | if (needed_size > allocated_size) { | 284 | if (needed_size > allocated_size) { |
| 285 | debug_strtab_sect.size = 0; // free the space | 285 | debug_strtab_sect.size = 0; // free the space |
| 286 | const new_offset = self.findFreeSpace(needed_size, 1); | 286 | const new_offset = self.findFreeSpace(needed_size, 1); |
| 287 | debug_strtab_sect.addr = dwarf_segment.vmaddr + new_offset - dwarf_segment.fileoff; | | |
| 288 | debug_strtab_sect.offset = @intCast(u32, new_offset); | 287 | debug_strtab_sect.offset = @intCast(u32, new_offset); |
| 289 | } | 288 | } |
| 290 | debug_strtab_sect.size = @intCast(u32, needed_size); | 289 | debug_strtab_sect.size = @intCast(u32, needed_size); |