| ... | ... | @@ -1908,8 +1908,23 @@ pub fn allocateAtom(self: *MachO, atom: *TextBlock, match: MatchingSection) !u64 |
| 1908 | 1908 | |
| 1909 | 1909 | // TODO we should check if we need to expand the section or not like we |
| 1910 | 1910 | // do in `allocateTextBlock`. |
| 1911 | const n_sect = @intCast(u8, self.section_ordinals.getIndex(match).? + 1); |
| 1911 | 1912 | sym.n_value = vaddr; |
| 1912 | | sym.n_sect = @intCast(u8, self.section_ordinals.getIndex(match).? + 1); |
| 1913 | sym.n_sect = n_sect; |
| 1914 | |
| 1915 | // Update each alias (if any) |
| 1916 | for (atom.aliases.items) |index| { |
| 1917 | const alias_sym = &self.locals.items[index]; |
| 1918 | alias_sym.n_value = vaddr; |
| 1919 | alias_sym.n_sect = n_sect; |
| 1920 | } |
| 1921 | |
| 1922 | // Update each symbol contained within the TextBlock |
| 1923 | for (atom.contained.items) |sym_at_off| { |
| 1924 | const contained_sym = &self.locals.items[sym_at_off.local_sym_index]; |
| 1925 | contained_sym.n_value = vaddr + sym_at_off.offset; |
| 1926 | contained_sym.n_sect = n_sect; |
| 1927 | } |
| 1913 | 1928 | |
| 1914 | 1929 | if (self.blocks.getPtr(match)) |last| { |
| 1915 | 1930 | last.*.next = atom; |