Skip to content

Commit 93b717b

Browse files
committed
Update relocateOneCompactUnwindEntry, don't get address in it, it might be invalid.
Signed-off-by: Peter Rong <[email protected]>
1 parent 90fd2fc commit 93b717b

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

lld/MachO/BPSectionOrderer.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ getRelocHash(const Reloc &reloc,
6262
}
6363

6464
// Get a hash of the unwind info (after relocation).
65-
// This hash is not 100% accurate, but it's good enough for compression.
6665
//
6766
// Unwind info will be eliminated if it is the same as its neighbors.
6867
// We want to order functions such that the ones with similar unwind info

lld/MachO/UnwindInfoSection.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ CREATE_LAYOUT_CLASS(CompactUnwind, FOR_EACH_CU_FIELD);
111111

112112
void lld::macho::CompactUnwindEntry::relocateOneCompactUnwindEntry(
113113
const Defined *d) {
114-
functionAddress = d->getVA();
115114

116115
ConcatInputSection *unwindEntry = d->unwindEntry();
117116
if (!unwindEntry)
@@ -389,7 +388,9 @@ Symbol *UnwindInfoSectionImpl::canonicalizePersonality(Symbol *personality) {
389388
void UnwindInfoSectionImpl::relocateCompactUnwind(
390389
std::vector<CompactUnwindEntry> &cuEntries) {
391390
parallelFor(0, symbolsVec.size(), [&](size_t i) {
392-
cuEntries[i].relocateOneCompactUnwindEntry(symbolsVec[i].second);
391+
const Defined *d = symbolsVec[i].second;
392+
cuEntries[i].functionAddress = d->getVA();
393+
cuEntries[i].relocateOneCompactUnwindEntry(d);
393394
});
394395
}
395396

lld/MachO/UnwindInfoSection.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ struct CompactUnwindEntry {
3939
uint64_t functionAddress;
4040
uint32_t functionLength;
4141
compact_unwind_encoding_t encoding;
42-
Symbol *personality;
43-
InputSection *lsda;
42+
Symbol *personality = nullptr;
43+
InputSection *lsda = nullptr;
4444

4545
// Relocate the entry to the given Symbol.
4646
void relocateOneCompactUnwindEntry(const Defined *d);

0 commit comments

Comments
 (0)