| author | |
| committer | |
| log | d136d06a77baeef8680b6a8f334922a8f70da2bf |
| tree | 0dc163399061de672322af731a7a886217982158 |
| parent | e2bfd6fc691a92f9dc36597a8febb03293b0f5ad |
2 files changed, 18 insertions(+), 3 deletions(-)
src/link/MachO/dyld_info/Rebase.zig+14-1| ... | ... | @@ -25,9 +25,10 @@ pub fn updateSize(rebase: *Rebase, macho_file: *MachO) !void { |
| 25 | 25 | |
| 26 | 26 | const gpa = macho_file.base.comp.gpa; |
| 27 | 27 | |
| 28 | var objects = try std.ArrayList(File.Index).initCapacity(gpa, macho_file.objects.items.len + 1); | |
| 28 | var objects = try std.ArrayList(File.Index).initCapacity(gpa, macho_file.objects.items.len + 2); | |
| 29 | 29 | defer objects.deinit(); |
| 30 | 30 | objects.appendSliceAssumeCapacity(macho_file.objects.items); |
| 31 | if (macho_file.getZigObject()) |obj| objects.appendAssumeCapacity(obj.index); | |
| 31 | 32 | if (macho_file.getInternalObject()) |obj| objects.appendAssumeCapacity(obj.index); |
| 32 | 33 | |
| 33 | 34 | for (objects.items) |index| { |
| ... | ... | @@ -55,6 +56,18 @@ pub fn updateSize(rebase: *Rebase, macho_file: *MachO) !void { |
| 55 | 56 | } |
| 56 | 57 | } |
| 57 | 58 | |
| 59 | if (macho_file.zig_got_sect_index) |sid| { | |
| 60 | const seg_id = macho_file.sections.items(.segment_id)[sid]; | |
| 61 | const seg = macho_file.segments.items[seg_id]; | |
| 62 | for (0..macho_file.zig_got.entries.items.len) |idx| { | |
| 63 | const addr = macho_file.zig_got.entryAddress(@intCast(idx), macho_file); | |
| 64 | try rebase.entries.append(gpa, .{ | |
| 65 | .offset = addr - seg.vmaddr, | |
| 66 | .segment_id = seg_id, | |
| 67 | }); | |
| 68 | } | |
| 69 | } | |
| 70 | ||
| 58 | 71 | if (macho_file.got_sect_index) |sid| { |
| 59 | 72 | const seg_id = macho_file.sections.items(.segment_id)[sid]; |
| 60 | 73 | const seg = macho_file.segments.items[seg_id]; |
src/link/MachO/dyld_info/bind.zig+4-2| ... | ... | @@ -35,9 +35,10 @@ pub const Bind = struct { |
| 35 | 35 | const gpa = macho_file.base.comp.gpa; |
| 36 | 36 | const cpu_arch = macho_file.getTarget().cpu.arch; |
| 37 | 37 | |
| 38 | var objects = try std.ArrayList(File.Index).initCapacity(gpa, macho_file.objects.items.len + 1); | |
| 38 | var objects = try std.ArrayList(File.Index).initCapacity(gpa, macho_file.objects.items.len + 2); | |
| 39 | 39 | defer objects.deinit(); |
| 40 | 40 | objects.appendSliceAssumeCapacity(macho_file.objects.items); |
| 41 | if (macho_file.getZigObject()) |obj| objects.appendAssumeCapacity(obj.index); | |
| 41 | 42 | if (macho_file.getInternalObject()) |obj| objects.appendAssumeCapacity(obj.index); |
| 42 | 43 | |
| 43 | 44 | for (objects.items) |index| { |
| ... | ... | @@ -286,9 +287,10 @@ pub const WeakBind = struct { |
| 286 | 287 | const gpa = macho_file.base.comp.gpa; |
| 287 | 288 | const cpu_arch = macho_file.getTarget().cpu.arch; |
| 288 | 289 | |
| 289 | var objects = try std.ArrayList(File.Index).initCapacity(gpa, macho_file.objects.items.len + 1); | |
| 290 | var objects = try std.ArrayList(File.Index).initCapacity(gpa, macho_file.objects.items.len + 2); | |
| 290 | 291 | defer objects.deinit(); |
| 291 | 292 | objects.appendSliceAssumeCapacity(macho_file.objects.items); |
| 293 | if (macho_file.getZigObject()) |obj| objects.appendAssumeCapacity(obj.index); | |
| 292 | 294 | if (macho_file.getInternalObject()) |obj| objects.appendAssumeCapacity(obj.index); |
| 293 | 295 | |
| 294 | 296 | for (objects.items) |index| { |