diff options
| author | Jakub Konka <kubkon@jakubkonka.com> | 2023-08-27 07:31:29 +0200 |
|---|---|---|
| committer | Jakub Konka <kubkon@jakubkonka.com> | 2023-08-29 11:39:35 +0200 |
| commit | 42e0850d78e63fcc602dd0e167ac90dfb3cfec02 (patch) | |
| tree | 62cbed417608fcffc6c7ef4f3bda6045d067f00a /src/link/MachO/Object.zig | |
| parent | 84853c5c56e87a7ee6c5392756b0773b650d283c (diff) | |
| download | zig-42e0850d78e63fcc602dd0e167ac90dfb3cfec02.tar.gz zig-42e0850d78e63fcc602dd0e167ac90dfb3cfec02.zip | |
macho: save indexes to all sections of interest
Diffstat (limited to 'src/link/MachO/Object.zig')
| -rw-r--r-- | src/link/MachO/Object.zig | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/link/MachO/Object.zig b/src/link/MachO/Object.zig index 5042fe9849..3ab62ec191 100644 --- a/src/link/MachO/Object.zig +++ b/src/link/MachO/Object.zig @@ -687,8 +687,8 @@ fn parseEhFrameSection(self: *Object, zld: *Zld, object_id: u32) !void { const gpa = zld.gpa; - if (zld.getSectionByName("__TEXT", "__eh_frame") == null) { - _ = try MachO.initSection(gpa, zld, "__TEXT", "__eh_frame", .{}); + if (zld.eh_frame_section_index == null) { + zld.eh_frame_section_index = try MachO.initSection(gpa, zld, "__TEXT", "__eh_frame", .{}); } const cpu_arch = zld.options.target.cpu.arch; @@ -788,8 +788,14 @@ fn parseUnwindInfo(self: *Object, zld: *Zld, object_id: u32) !void { // approach. However, we will only synthesise DWARF records and nothing more. For this reason, // we still create the output `__TEXT,__unwind_info` section. if (self.hasEhFrameRecords()) { - if (zld.getSectionByName("__TEXT", "__unwind_info") == null) { - _ = try MachO.initSection(gpa, zld, "__TEXT", "__unwind_info", .{}); + if (zld.unwind_info_section_index == null) { + zld.unwind_info_section_index = try MachO.initSection( + gpa, + zld, + "__TEXT", + "__unwind_info", + .{}, + ); } } return; @@ -797,8 +803,8 @@ fn parseUnwindInfo(self: *Object, zld: *Zld, object_id: u32) !void { log.debug("parsing unwind info in {s}", .{self.name}); - if (zld.getSectionByName("__TEXT", "__unwind_info") == null) { - _ = try MachO.initSection(gpa, zld, "__TEXT", "__unwind_info", .{}); + if (zld.unwind_info_section_index == null) { + zld.unwind_info_section_index = try MachO.initSection(gpa, zld, "__TEXT", "__unwind_info", .{}); } const unwind_records = self.getUnwindRecords(); |
