diff options
Diffstat (limited to 'COFF/MarkLive.cpp')
| -rw-r--r-- | COFF/MarkLive.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/COFF/MarkLive.cpp b/COFF/MarkLive.cpp index 0156d238b6726..25e5cc3506732 100644 --- a/COFF/MarkLive.cpp +++ b/COFF/MarkLive.cpp @@ -37,19 +37,26 @@ void markLive(const std::vector<Chunk *> &Chunks) { Worklist.push_back(C); }; + auto AddSym = [&](SymbolBody *B) { + if (auto *Sym = dyn_cast<DefinedRegular>(B)) + Enqueue(Sym->getChunk()); + else if (auto *Sym = dyn_cast<DefinedImportData>(B)) + Sym->File->Live = true; + else if (auto *Sym = dyn_cast<DefinedImportThunk>(B)) + Sym->WrappedSym->File->Live = true; + }; + // Add GC root chunks. for (SymbolBody *B : Config->GCRoot) - if (auto *D = dyn_cast<DefinedRegular>(B)) - Enqueue(D->getChunk()); + AddSym(B); while (!Worklist.empty()) { SectionChunk *SC = Worklist.pop_back_val(); assert(SC->isLive() && "We mark as live when pushing onto the worklist!"); // Mark all symbols listed in the relocation table for this section. - for (SymbolBody *S : SC->symbols()) - if (auto *D = dyn_cast<DefinedRegular>(S)) - Enqueue(D->getChunk()); + for (SymbolBody *B : SC->symbols()) + AddSym(B); // Mark associative sections if any. for (SectionChunk *C : SC->children()) |
