aboutsummaryrefslogtreecommitdiff
path: root/src/link/MachO/Object.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/link/MachO/Object.zig')
-rw-r--r--src/link/MachO/Object.zig13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/link/MachO/Object.zig b/src/link/MachO/Object.zig
index 2196e9ccf0..944cb7a677 100644
--- a/src/link/MachO/Object.zig
+++ b/src/link/MachO/Object.zig
@@ -725,7 +725,18 @@ fn parseEhFrameSection(self: *Object, zld: *Zld, object_id: u32) !void {
}
fn parseUnwindInfo(self: *Object, zld: *Zld, object_id: u32) !void {
- const sect = self.unwind_info_sect orelse return;
+ const sect = self.unwind_info_sect 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
+ // 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.eh_frame_sect != null) {
+ if (zld.getSectionByName("__TEXT", "__unwind_info") == null) {
+ _ = try zld.initSection("__TEXT", "__unwind_info", .{});
+ }
+ }
+ return;
+ };
log.debug("parsing unwind info in {s}", .{self.name});