File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -68,7 +68,18 @@ pub fn generate(info: *UnwindInfo, macho_file: *MachO) !void {
68
68
for (info .records .items ) | ref | {
69
69
const rec = ref .getUnwindRecord (macho_file );
70
70
if (rec .getFde (macho_file )) | fde | {
71
- rec .enc .setDwarfSectionOffset (@intCast (fde .out_offset ));
71
+ // The unwinder will look for the DWARF entry starting at the hint,
72
+ // assuming the hint points to a valid CFI record start. If it
73
+ // fails to find the record, it proceeds in a linear search through
74
+ // the contiguous CFI records from the hint until the end of the
75
+ // section. Ideally, in the case where the offset is too large to
76
+ // be encoded, we would instead encode the largest possible offset
77
+ // to a valid CFI record, but since we don't keep track of that,
78
+ // just encode zero -- the start of the section is always the start
79
+ // of a CFI record.
80
+ const hint = std .math .cast (u24 , fde .out_offset ) orelse 0 ;
81
+ rec .enc .setDwarfSectionOffset (hint );
82
+
72
83
if (fde .getLsdaAtom (macho_file )) | lsda | {
73
84
rec .lsda = lsda .atom_index ;
74
85
rec .lsda_offset = fde .lsda_offset ;
You can’t perform that action at this time.
0 commit comments