| ... | @@ -39,6 +39,8 @@ load_commands: std.ArrayListUnmanaged(LoadCommand) = .{}, | ... | @@ -39,6 +39,8 @@ load_commands: std.ArrayListUnmanaged(LoadCommand) = .{}, |
| 39 | pagezero_segment_cmd_index: ?u16 = null, | 39 | pagezero_segment_cmd_index: ?u16 = null, |
| 40 | /// __TEXT segment | 40 | /// __TEXT segment |
| 41 | text_segment_cmd_index: ?u16 = null, | 41 | text_segment_cmd_index: ?u16 = null, |
| | 42 | /// __DATA_CONST segment |
| | 43 | data_const_segment_cmd_index: ?u16 = null, |
| 42 | /// __DATA segment | 44 | /// __DATA segment |
| 43 | data_segment_cmd_index: ?u16 = null, | 45 | data_segment_cmd_index: ?u16 = null, |
| 44 | /// __LINKEDIT segment | 46 | /// __LINKEDIT segment |
| ... | @@ -171,6 +173,15 @@ pub fn populateMissingMetadata(self: *DebugSymbols, allocator: *Allocator) !void | ... | @@ -171,6 +173,15 @@ pub fn populateMissingMetadata(self: *DebugSymbols, allocator: *Allocator) !void |
| 171 | self.header_dirty = true; | 173 | self.header_dirty = true; |
| 172 | self.load_commands_dirty = true; | 174 | self.load_commands_dirty = true; |
| 173 | } | 175 | } |
| | 176 | if (self.data_const_segment_cmd_index == null) outer: { |
| | 177 | if (self.base.data_const_segment_cmd_index == null) break :outer; // __DATA_CONST is optional |
| | 178 | self.data_const_segment_cmd_index = @intCast(u16, self.load_commands.items.len); |
| | 179 | const base_cmd = self.base.load_commands.items[self.base.data_const_segment_cmd_index.?].Segment; |
| | 180 | const cmd = try self.copySegmentCommand(allocator, base_cmd); |
| | 181 | try self.load_commands.append(allocator, .{ .Segment = cmd }); |
| | 182 | self.header_dirty = true; |
| | 183 | self.load_commands_dirty = true; |
| | 184 | } |
| 174 | if (self.data_segment_cmd_index == null) outer: { | 185 | if (self.data_segment_cmd_index == null) outer: { |
| 175 | if (self.base.data_segment_cmd_index == null) break :outer; // __DATA is optional | 186 | if (self.base.data_segment_cmd_index == null) break :outer; // __DATA is optional |
| 176 | self.data_segment_cmd_index = @intCast(u16, self.load_commands.items.len); | 187 | self.data_segment_cmd_index = @intCast(u16, self.load_commands.items.len); |