@@ -111,10 +111,12 @@ CREATE_LAYOUT_CLASS(CompactUnwind, FOR_EACH_CU_FIELD);
111111
112112void lld::macho::CompactUnwindEntry::relocateOneCompactUnwindEntry (
113113 const Defined *d) {
114+ functionAddress = d->getVA ();
115+
114116 ConcatInputSection *unwindEntry = d->unwindEntry ();
115- assert (unwindEntry);
117+ if (!unwindEntry)
118+ return ;
116119
117- functionAddress = d->getVA ();
118120 // If we have DWARF unwind info, create a slimmed-down CU entry that points
119121 // to it.
120122 if (unwindEntry->getName () == section_names::ehFrame) {
@@ -126,12 +128,11 @@ void lld::macho::CompactUnwindEntry::relocateOneCompactUnwindEntry(
126128 // would instead encode the largest possible offset to a valid CFI record,
127129 // but since we don't keep track of that, just encode zero -- the start of
128130 // the section is always the start of a CFI record.
129- uint64_t dwarfOffsetHint =
130- d->unwindEntry ()->outSecOff <= DWARF_SECTION_OFFSET
131- ? d->unwindEntry ()->outSecOff
132- : 0 ;
131+ uint64_t dwarfOffsetHint = unwindEntry->outSecOff <= DWARF_SECTION_OFFSET
132+ ? unwindEntry->outSecOff
133+ : 0 ;
133134 encoding = target->modeDwarfEncoding | dwarfOffsetHint;
134- const FDE &fde = cast<ObjFile>(d->getFile ())->fdes [d-> unwindEntry () ];
135+ const FDE &fde = cast<ObjFile>(d->getFile ())->fdes [unwindEntry];
135136 functionLength = fde.funcLength ;
136137 // Omit the DWARF personality from compact-unwind entry so that we
137138 // don't need to encode it.
@@ -388,13 +389,7 @@ Symbol *UnwindInfoSectionImpl::canonicalizePersonality(Symbol *personality) {
388389void UnwindInfoSectionImpl::relocateCompactUnwind (
389390 std::vector<CompactUnwindEntry> &cuEntries) {
390391 parallelFor (0 , symbolsVec.size (), [&](size_t i) {
391- CompactUnwindEntry &cu = cuEntries[i];
392- const Defined *d = symbolsVec[i].second ;
393- cu.functionAddress = d->getVA ();
394- if (!d->unwindEntry ())
395- return ;
396-
397- cu.relocateOneCompactUnwindEntry (d);
392+ cuEntries[i].relocateOneCompactUnwindEntry (symbolsVec[i].second );
398393 });
399394}
400395
0 commit comments