Replace SharedSymbols with Defined when creating copy relocations.

This is slightly simpler to read IMHO. Now if a symbol has a position
in the file, it is Defined.

The main motivation is that with this a SharedSymbol doesn't need a
section, which reduces the size of SymbolUnion.

With this the peak allocation when linking chromium goes from 568.1 to
564.2 MB.

llvm-svn: 330966
This commit is contained in:
Rafael Espindola
2018-04-26 17:58:58 +00:00
parent b09308d82a
commit ab0cce5f1f
9 changed files with 65 additions and 83 deletions

View File

@@ -1111,8 +1111,8 @@ ExprValue LinkerScript::getSymbolValue(StringRef Name, const Twine &Loc) {
if (auto *DS = dyn_cast<Defined>(Sym))
return {DS->Section, false, DS->Value, Loc};
if (auto *SS = dyn_cast<SharedSymbol>(Sym))
if (!ErrorOnMissingSection || SS->CopyRelSec)
return {SS->CopyRelSec, false, 0, Loc};
if (!ErrorOnMissingSection)
return {nullptr, false, 0, Loc};
}
error(Loc + ": symbol not found: " + Name);