| ... | ... | @@ -65,6 +65,9 @@ stub_helper_section_index: ?u16 = null, |
| 65 | 65 | text_const_section_index: ?u16 = null, |
| 66 | 66 | cstring_section_index: ?u16 = null, |
| 67 | 67 | ustring_section_index: ?u16 = null, |
| 68 | gcc_except_tab: ?u16 = null, |
| 69 | unwind_info: ?u16 = null, |
| 70 | eh_frame: ?u16 = null, |
| 68 | 71 | |
| 69 | 72 | // __DATA_CONST segment sections |
| 70 | 73 | got_section_index: ?u16 = null, |
| ... | ... | @@ -649,6 +652,7 @@ fn updateMetadata(self: *Zld) !void { |
| 649 | 652 | }); |
| 650 | 653 | continue; |
| 651 | 654 | } |
| 655 | |
| 652 | 656 | if (sect.isDebug()) { |
| 653 | 657 | if (mem.eql(u8, "__LD", segname) and mem.eql(u8, "__compact_unwind", sectname)) { |
| 654 | 658 | log.debug("TODO compact unwind section: type 0x{x}, name '{s},{s}'", .{ |
| ... | ... | @@ -677,6 +681,24 @@ fn updateMetadata(self: *Zld) !void { |
| 677 | 681 | .reserved2 = 0, |
| 678 | 682 | .reserved3 = 0, |
| 679 | 683 | }); |
| 684 | } else if (mem.eql(u8, sectname, "__gcc_except_tab")) { |
| 685 | if (self.gcc_except_tab != null) continue; |
| 686 | |
| 687 | self.gcc_except_tab = @intCast(u16, text_seg.sections.items.len); |
| 688 | try text_seg.addSection(self.allocator, .{ |
| 689 | .sectname = makeStaticString("__gcc_except_tab"), |
| 690 | .segname = makeStaticString("__TEXT"), |
| 691 | .addr = 0, |
| 692 | .size = 0, |
| 693 | .offset = 0, |
| 694 | .@"align" = 0, |
| 695 | .reloff = 0, |
| 696 | .nreloc = 0, |
| 697 | .flags = macho.S_REGULAR, |
| 698 | .reserved1 = 0, |
| 699 | .reserved2 = 0, |
| 700 | .reserved3 = 0, |
| 701 | }); |
| 680 | 702 | } else { |
| 681 | 703 | if (self.text_const_section_index != null) continue; |
| 682 | 704 | |
| ... | ... | @@ -975,6 +997,11 @@ fn getMatchingSection(self: *Zld, sect: Object.Section) ?MatchingSection { |
| 975 | 997 | .seg = self.text_segment_cmd_index.?, |
| 976 | 998 | .sect = self.ustring_section_index.?, |
| 977 | 999 | }; |
| 1000 | } else if (mem.eql(u8, sectname, "__gcc_except_tab")) { |
| 1001 | break :blk .{ |
| 1002 | .seg = self.text_segment_cmd_index.?, |
| 1003 | .sect = self.gcc_except_tab.?, |
| 1004 | }; |
| 978 | 1005 | } else { |
| 979 | 1006 | break :blk .{ |
| 980 | 1007 | .seg = self.text_segment_cmd_index.?, |
| ... | ... | @@ -1031,6 +1058,7 @@ fn sortSections(self: *Zld) !void { |
| 1031 | 1058 | &self.text_section_index, |
| 1032 | 1059 | &self.stubs_section_index, |
| 1033 | 1060 | &self.stub_helper_section_index, |
| 1061 | &self.gcc_except_tab, |
| 1034 | 1062 | &self.text_const_section_index, |
| 1035 | 1063 | &self.cstring_section_index, |
| 1036 | 1064 | &self.ustring_section_index, |