| ... | @@ -376,30 +376,6 @@ pub fn openPath(allocator: *Allocator, sub_path: []const u8, options: link.Optio | ... | @@ -376,30 +376,6 @@ pub fn openPath(allocator: *Allocator, sub_path: []const u8, options: link.Optio |
| 376 | try self.populateMissingMetadata(); | 376 | try self.populateMissingMetadata(); |
| 377 | try self.writeLocalSymbol(0); | 377 | try self.writeLocalSymbol(0); |
| 378 | | 378 | |
| 379 | if (self.dyld_stub_binder_index == null) { | | |
| 380 | self.dyld_stub_binder_index = @intCast(u32, self.undefs.items.len); | | |
| 381 | const n_strx = try self.makeString("dyld_stub_binder"); | | |
| 382 | try self.undefs.append(self.base.allocator, .{ | | |
| 383 | .n_strx = n_strx, | | |
| 384 | .n_type = macho.N_UNDF | macho.N_EXT, | | |
| 385 | .n_sect = 0, | | |
| 386 | .n_desc = @intCast(u8, 1) * macho.N_SYMBOL_RESOLVER, | | |
| 387 | .n_value = 0, | | |
| 388 | }); | | |
| 389 | try self.symbol_resolver.putNoClobber(self.base.allocator, n_strx, .{ | | |
| 390 | .where = .undef, | | |
| 391 | .where_index = self.dyld_stub_binder_index.?, | | |
| 392 | }); | | |
| 393 | const got_key = GotIndirectionKey{ | | |
| 394 | .where = .undef, | | |
| 395 | .where_index = self.dyld_stub_binder_index.?, | | |
| 396 | }; | | |
| 397 | const got_index = @intCast(u32, self.got_entries.items.len); | | |
| 398 | try self.got_entries.append(self.base.allocator, got_key); | | |
| 399 | try self.got_entries_map.putNoClobber(self.base.allocator, got_key, got_index); | | |
| 400 | try self.writeGotEntry(got_index); | | |
| 401 | self.binding_info_dirty = true; | | |
| 402 | } | | |
| 403 | if (self.stub_helper_stubs_start_off == null) { | 379 | if (self.stub_helper_stubs_start_off == null) { |
| 404 | try self.writeStubHelperPreamble(); | 380 | try self.writeStubHelperPreamble(); |
| 405 | } | 381 | } |
| ... | @@ -1089,6 +1065,7 @@ fn parseInputFiles(self: *MachO, files: []const []const u8, syslibroot: ?[]const | ... | @@ -1089,6 +1065,7 @@ fn parseInputFiles(self: *MachO, files: []const []const u8, syslibroot: ?[]const |
| 1089 | break :full_path try self.base.allocator.dupe(u8, path); | 1065 | break :full_path try self.base.allocator.dupe(u8, path); |
| 1090 | }; | 1066 | }; |
| 1091 | defer self.base.allocator.free(full_path); | 1067 | defer self.base.allocator.free(full_path); |
| | 1068 | log.debug("parsing input file path '{s}'", .{full_path}); |
| 1092 | | 1069 | |
| 1093 | if (try self.parseObject(full_path)) continue; | 1070 | if (try self.parseObject(full_path)) continue; |
| 1094 | if (try self.parseArchive(full_path)) continue; | 1071 | if (try self.parseArchive(full_path)) continue; |
| ... | @@ -1102,6 +1079,7 @@ fn parseInputFiles(self: *MachO, files: []const []const u8, syslibroot: ?[]const | ... | @@ -1102,6 +1079,7 @@ fn parseInputFiles(self: *MachO, files: []const []const u8, syslibroot: ?[]const |
| 1102 | | 1079 | |
| 1103 | fn parseLibs(self: *MachO, libs: []const []const u8, syslibroot: ?[]const u8) !void { | 1080 | fn parseLibs(self: *MachO, libs: []const []const u8, syslibroot: ?[]const u8) !void { |
| 1104 | for (libs) |lib| { | 1081 | for (libs) |lib| { |
| | 1082 | log.debug("parsing lib path '{s}'", .{lib}); |
| 1105 | if (try self.parseDylib(lib, .{ | 1083 | if (try self.parseDylib(lib, .{ |
| 1106 | .syslibroot = syslibroot, | 1084 | .syslibroot = syslibroot, |
| 1107 | })) continue; | 1085 | })) continue; |
| ... | @@ -2510,6 +2488,11 @@ fn resolveDyldStubBinder(self: *MachO) !void { | ... | @@ -2510,6 +2488,11 @@ fn resolveDyldStubBinder(self: *MachO) !void { |
| 2510 | | 2488 | |
| 2511 | self.binding_info_dirty = true; | 2489 | self.binding_info_dirty = true; |
| 2512 | self.got_entries_count_dirty = true; | 2490 | self.got_entries_count_dirty = true; |
| | 2491 | |
| | 2492 | if (!(build_options.is_stage1 and self.base.options.use_stage1)) { |
| | 2493 | // TODO remove once we can incrementally update in stage1 too. |
| | 2494 | try self.writeGotEntry(got_index); |
| | 2495 | } |
| 2513 | } | 2496 | } |
| 2514 | | 2497 | |
| 2515 | fn parseTextBlocks(self: *MachO) !void { | 2498 | fn parseTextBlocks(self: *MachO) !void { |