| ... | @@ -1950,8 +1950,6 @@ pub fn allocateAtom(self: *MachO, atom: *TextBlock, match: MatchingSection) !u64 | ... | @@ -1950,8 +1950,6 @@ pub fn allocateAtom(self: *MachO, atom: *TextBlock, match: MatchingSection) !u64 |
| 1950 | break :blk end_addr; | 1950 | break :blk end_addr; |
| 1951 | }; | 1951 | }; |
| 1952 | assert(needed_size <= end_addr); // TODO must expand the section | 1952 | assert(needed_size <= end_addr); // TODO must expand the section |
| 1953 | sect.size = needed_size; | | |
| 1954 | self.load_commands_dirty = true; | | |
| 1955 | } | 1953 | } |
| 1956 | const n_sect = @intCast(u8, self.section_ordinals.getIndex(match).? + 1); | 1954 | const n_sect = @intCast(u8, self.section_ordinals.getIndex(match).? + 1); |
| 1957 | sym.n_value = vaddr; | 1955 | sym.n_value = vaddr; |
| ... | @@ -4599,17 +4597,7 @@ fn allocateTextBlock(self: *MachO, text_block: *TextBlock, new_block_size: u64, | ... | @@ -4599,17 +4597,7 @@ fn allocateTextBlock(self: *MachO, text_block: *TextBlock, new_block_size: u64, |
| 4599 | if (expand_text_section) { | 4597 | if (expand_text_section) { |
| 4600 | const needed_size = (vaddr + new_block_size) - text_section.addr; | 4598 | const needed_size = (vaddr + new_block_size) - text_section.addr; |
| 4601 | assert(needed_size <= text_segment.inner.filesize); // TODO must move the entire text section. | 4599 | assert(needed_size <= text_segment.inner.filesize); // TODO must move the entire text section. |
| 4602 | | | |
| 4603 | _ = try self.blocks.put(self.base.allocator, match, text_block); | 4600 | _ = try self.blocks.put(self.base.allocator, match, text_block); |
| 4604 | text_section.size = needed_size; | | |
| 4605 | self.load_commands_dirty = true; // TODO Make more granular. | | |
| 4606 | | | |
| 4607 | if (self.d_sym) |*ds| { | | |
| 4608 | const debug_text_seg = &ds.load_commands.items[ds.text_segment_cmd_index.?].Segment; | | |
| 4609 | const debug_text_sect = &debug_text_seg.sections.items[ds.text_section_index.?]; | | |
| 4610 | debug_text_sect.size = needed_size; | | |
| 4611 | ds.load_commands_dirty = true; | | |
| 4612 | } | | |
| 4613 | } | 4601 | } |
| 4614 | text_block.size = new_block_size; | 4602 | text_block.size = new_block_size; |
| 4615 | | 4603 | |