aboutsummaryrefslogtreecommitdiff
path: root/src/link/MachO/Object.zig
diff options
context:
space:
mode:
authorJakub Konka <kubkon@jakubkonka.com>2023-08-26 08:13:41 +0200
committerJakub Konka <kubkon@jakubkonka.com>2023-08-29 11:39:34 +0200
commitb2773cd7120f7120410e1635aaeec026c7bbcdd1 (patch)
treecd7defea6ddbd23930c3e168b066cfbd75febe61 /src/link/MachO/Object.zig
parent180979ee41e7374ee1b8bc941e2281bb44e41dfd (diff)
downloadzig-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.zig14
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();