| ... | ... | @@ -1636,7 +1636,11 @@ fn resolveSymbols(self: *Zld) !void { |
| 1636 | 1636 | } |
| 1637 | 1637 | |
| 1638 | 1638 | // Second pass, resolve symbols in static libraries. |
| 1639 | | loop: for (self.undefs.items) |sym| { |
| 1639 | var next_sym: usize = 0; |
| 1640 | loop: while (true) : (next_sym += 1) { |
| 1641 | if (next_sym == self.undefs.items.len) break; |
| 1642 | |
| 1643 | const sym = self.undefs.items[next_sym]; |
| 1640 | 1644 | if (symbolIsNull(sym)) continue; |
| 1641 | 1645 | |
| 1642 | 1646 | const sym_name = self.getString(sym.n_strx); |
| ... | ... | @@ -1661,6 +1665,8 @@ fn resolveSymbols(self: *Zld) !void { |
| 1661 | 1665 | // Convert any tentative definition into a regular symbol and allocate |
| 1662 | 1666 | // text blocks for each tentative defintion. |
| 1663 | 1667 | for (self.tentatives.items) |sym| { |
| 1668 | if (symbolIsNull(sym)) continue; |
| 1669 | |
| 1664 | 1670 | const sym_name = self.getString(sym.n_strx); |
| 1665 | 1671 | const match: MatchingSection = blk: { |
| 1666 | 1672 | if (self.common_section_index == null) { |
| ... | ... | @@ -1813,6 +1819,13 @@ fn resolveSymbols(self: *Zld) !void { |
| 1813 | 1819 | .n_desc = macho.N_WEAK_DEF, |
| 1814 | 1820 | .n_value = seg.inner.vmaddr, |
| 1815 | 1821 | }); |
| 1822 | undef.* = .{ |
| 1823 | .n_strx = 0, |
| 1824 | .n_type = macho.N_UNDF, |
| 1825 | .n_sect = 0, |
| 1826 | .n_desc = 0, |
| 1827 | .n_value = 0, |
| 1828 | }; |
| 1816 | 1829 | resolv.* = .{ |
| 1817 | 1830 | .where = .global, |
| 1818 | 1831 | .where_index = global_sym_index, |