parent
67ab269e1d
commit
332fc712c6
|
|
@ -113,7 +113,7 @@ struct Configuration {
|
||||||
std::vector<llvm::StringRef> argv;
|
std::vector<llvm::StringRef> argv;
|
||||||
|
|
||||||
// Symbols in this set are considered as live by the garbage collector.
|
// Symbols in this set are considered as live by the garbage collector.
|
||||||
std::vector<Symbol *> gCRoot;
|
std::vector<Symbol *> gcroot;
|
||||||
|
|
||||||
std::set<std::string> noDefaultLibs;
|
std::set<std::string> noDefaultLibs;
|
||||||
bool noDefaultLibAll = false;
|
bool noDefaultLibAll = false;
|
||||||
|
|
|
||||||
|
|
@ -497,7 +497,7 @@ Symbol *LinkerDriver::addUndefined(StringRef name) {
|
||||||
Symbol *b = symtab->addUndefined(name);
|
Symbol *b = symtab->addUndefined(name);
|
||||||
if (!b->isGCRoot) {
|
if (!b->isGCRoot) {
|
||||||
b->isGCRoot = true;
|
b->isGCRoot = true;
|
||||||
config->gCRoot.push_back(b);
|
config->gcroot.push_back(b);
|
||||||
}
|
}
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -832,7 +832,7 @@ void BitcodeFile::parse() {
|
||||||
}
|
}
|
||||||
symbols.push_back(sym);
|
symbols.push_back(sym);
|
||||||
if (objSym.isUsed())
|
if (objSym.isUsed())
|
||||||
config->gCRoot.push_back(sym);
|
config->gcroot.push_back(sym);
|
||||||
}
|
}
|
||||||
directives = obj->getCOFFLinkerOpts();
|
directives = obj->getCOFFLinkerOpts();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,13 +15,13 @@
|
||||||
namespace lld {
|
namespace lld {
|
||||||
namespace coff {
|
namespace coff {
|
||||||
|
|
||||||
static Timer gCTimer("GC", Timer::root());
|
static Timer gctimer("GC", Timer::root());
|
||||||
|
|
||||||
// Set live bit on for each reachable chunk. Unmarked (unreachable)
|
// Set live bit on for each reachable chunk. Unmarked (unreachable)
|
||||||
// COMDAT chunks will be ignored by Writer, so they will be excluded
|
// COMDAT chunks will be ignored by Writer, so they will be excluded
|
||||||
// from the final output.
|
// from the final output.
|
||||||
void markLive(ArrayRef<Chunk *> chunks) {
|
void markLive(ArrayRef<Chunk *> chunks) {
|
||||||
ScopedTimer t(gCTimer);
|
ScopedTimer t(gctimer);
|
||||||
|
|
||||||
// We build up a worklist of sections which have been marked as live. We only
|
// We build up a worklist of sections which have been marked as live. We only
|
||||||
// push into the worklist when we discover an unmarked section, and we mark
|
// push into the worklist when we discover an unmarked section, and we mark
|
||||||
|
|
@ -51,7 +51,7 @@ void markLive(ArrayRef<Chunk *> chunks) {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Add GC root chunks.
|
// Add GC root chunks.
|
||||||
for (Symbol *b : config->gCRoot)
|
for (Symbol *b : config->gcroot)
|
||||||
addSym(b);
|
addSym(b);
|
||||||
|
|
||||||
while (!worklist.empty()) {
|
while (!worklist.empty()) {
|
||||||
|
|
|
||||||
|
|
@ -293,7 +293,7 @@ void SymbolTable::reportRemainingUndefines() {
|
||||||
if (undefs.empty() && localImports.empty())
|
if (undefs.empty() && localImports.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (Symbol *b : config->gCRoot) {
|
for (Symbol *b : config->gcroot) {
|
||||||
if (undefs.count(b))
|
if (undefs.count(b))
|
||||||
errorOrWarn("<root>: undefined symbol: " + toString(*b));
|
errorOrWarn("<root>: undefined symbol: " + toString(*b));
|
||||||
if (config->warnLocallyDefinedImported)
|
if (config->warnLocallyDefinedImported)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue