diff options
| author | Jakub Konka <kubkon@jakubkonka.com> | 2023-08-26 08:13:41 +0200 |
|---|---|---|
| committer | Jakub Konka <kubkon@jakubkonka.com> | 2023-08-29 11:39:34 +0200 |
| commit | b2773cd7120f7120410e1635aaeec026c7bbcdd1 (patch) | |
| tree | cd7defea6ddbd23930c3e168b066cfbd75febe61 /src/link/MachO/Object.zig | |
| parent | 180979ee41e7374ee1b8bc941e2281bb44e41dfd (diff) | |
| download | zig-b2773cd7120f7120410e1635aaeec026c7bbcdd1.tar.gz zig-b2773cd7120f7120410e1635aaeec026c7bbcdd1.zip | |
macho: move initSection into MachO from Zld
Diffstat (limited to 'src/link/MachO/Object.zig')
| -rw-r--r-- | src/link/MachO/Object.zig | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/link/MachO/Object.zig b/src/link/MachO/Object.zig index c9f32aa4fd..2eee9f5787 100644 --- a/src/link/MachO/Object.zig +++ b/src/link/MachO/Object.zig @@ -685,11 +685,12 @@ fn parseEhFrameSection(self: *Object, zld: *Zld, object_id: u32) !void { log.debug("parsing __TEXT,__eh_frame section", .{}); + const gpa = zld.gpa; + if (zld.getSectionByName("__TEXT", "__eh_frame") == null) { - _ = try zld.initSection("__TEXT", "__eh_frame", .{}); + _ = try MachO.initSection(gpa, zld, "__TEXT", "__eh_frame", .{}); } - const gpa = zld.gpa; const cpu_arch = zld.options.target.cpu.arch; try self.parseRelocs(gpa, sect_id); const relocs = self.getRelocs(sect_id); @@ -779,6 +780,8 @@ fn parseEhFrameSection(self: *Object, zld: *Zld, object_id: u32) !void { } fn parseUnwindInfo(self: *Object, zld: *Zld, object_id: u32) !void { + const gpa = zld.gpa; + const cpu_arch = zld.options.target.cpu.arch; const sect_id = self.unwind_info_sect_id orelse { // If it so happens that the object had `__eh_frame` section defined but no `__compact_unwind`, // we will try fully synthesising unwind info records to somewhat match Apple ld's @@ -786,7 +789,7 @@ fn parseUnwindInfo(self: *Object, zld: *Zld, object_id: u32) !void { // we still create the output `__TEXT,__unwind_info` section. if (self.hasEhFrameRecords()) { if (zld.getSectionByName("__TEXT", "__unwind_info") == null) { - _ = try zld.initSection("__TEXT", "__unwind_info", .{}); + _ = try MachO.initSection(gpa, zld, "__TEXT", "__unwind_info", .{}); } } return; @@ -794,11 +797,8 @@ fn parseUnwindInfo(self: *Object, zld: *Zld, object_id: u32) !void { log.debug("parsing unwind info in {s}", .{self.name}); - const gpa = zld.gpa; - const cpu_arch = zld.options.target.cpu.arch; - if (zld.getSectionByName("__TEXT", "__unwind_info") == null) { - _ = try zld.initSection("__TEXT", "__unwind_info", .{}); + _ = try MachO.initSection(gpa, zld, "__TEXT", "__unwind_info", .{}); } const unwind_records = self.getUnwindRecords(); |
