| ... | ... | @@ -2144,6 +2144,8 @@ pub const Zld = struct { |
| 2144 | 2144 | const segment = self.getSegment(@intCast(u8, sect_id)); |
| 2145 | 2145 | if (segment.maxprot & macho.PROT.WRITE == 0) continue; |
| 2146 | 2146 | |
| 2147 | log.debug("{s},{s}", .{ header.segName(), header.sectName() }); |
| 2148 | |
| 2147 | 2149 | const cpu_arch = self.options.target.cpu.arch; |
| 2148 | 2150 | var atom_index = slice.items(.first_atom_index)[sect_id]; |
| 2149 | 2151 | |
| ... | ... | @@ -2153,13 +2155,13 @@ pub const Zld = struct { |
| 2153 | 2155 | |
| 2154 | 2156 | const should_rebase = blk: { |
| 2155 | 2157 | if (self.dyld_private_sym_index) |sym_index| { |
| 2156 | | if (atom.sym_index == sym_index) break :blk false; |
| 2158 | if (atom.getFile() == null and atom.sym_index == sym_index) break :blk false; |
| 2157 | 2159 | } |
| 2158 | 2160 | break :blk !sym.undf(); |
| 2159 | 2161 | }; |
| 2160 | 2162 | |
| 2161 | 2163 | if (should_rebase) { |
| 2162 | | log.debug(" ATOM(%{d}, '{s}')", .{ atom.sym_index, self.getSymbolName(atom.getSymbolWithLoc()) }); |
| 2164 | log.debug(" ATOM({d}, %{d}, '{s}')", .{ atom_index, atom.sym_index, self.getSymbolName(atom.getSymbolWithLoc()) }); |
| 2163 | 2165 | |
| 2164 | 2166 | const object = self.objects.items[atom.getFile().?]; |
| 2165 | 2167 | const source_sym = object.getSourceSymbol(atom.sym_index).?; |
| ... | ... | @@ -2273,15 +2275,17 @@ pub const Zld = struct { |
| 2273 | 2275 | const cpu_arch = self.options.target.cpu.arch; |
| 2274 | 2276 | var atom_index = slice.items(.first_atom_index)[sect_id]; |
| 2275 | 2277 | |
| 2278 | log.debug("{s},{s}", .{ header.segName(), header.sectName() }); |
| 2279 | |
| 2276 | 2280 | while (true) { |
| 2277 | 2281 | const atom = self.getAtom(atom_index); |
| 2278 | 2282 | const sym = self.getSymbol(atom.getSymbolWithLoc()); |
| 2279 | 2283 | |
| 2280 | | log.debug(" ATOM(%{d}, '{s}')", .{ atom.sym_index, self.getSymbolName(atom.getSymbolWithLoc()) }); |
| 2284 | log.debug(" ATOM({d}, %{d}, '{s}')", .{ atom_index, atom.sym_index, self.getSymbolName(atom.getSymbolWithLoc()) }); |
| 2281 | 2285 | |
| 2282 | 2286 | const should_bind = blk: { |
| 2283 | 2287 | if (self.dyld_private_sym_index) |sym_index| { |
| 2284 | | if (atom.sym_index == sym_index) break :blk false; |
| 2288 | if (atom.getFile() == null and atom.sym_index == sym_index) break :blk false; |
| 2285 | 2289 | } |
| 2286 | 2290 | break :blk true; |
| 2287 | 2291 | }; |