// Some symbols (such as __ehdr_start) are defined lazily only when there
// are undefined symbols for them, so we add these to trigger that logic.
- for (StringRef Sym : Script->Opt.UndefinedSymbols)
+ for (StringRef Sym : Script->Opt.ReferencedSymbols)
Symtab.addUndefined(Sym);
for (auto *Arg : Args.filtered(OPT_wrap))
llvm::DenseMap<llvm::StringRef, MemoryRegion> MemoryRegions;
// A list of undefined symbols referenced by the script.
- std::vector<llvm::StringRef> UndefinedSymbols;
+ std::vector<llvm::StringRef> ReferencedSymbols;
};
class LinkerScript {
if (Tok == "SIZEOF_HEADERS")
return [=] { return elf::getHeaderSize(); };
+ // Tok is the dot.
+ if (Tok == ".")
+ return [=] { return Script->getSymbolValue(Location, Tok); };
+
// Tok is a literal number.
uint64_t V;
if (readInteger(Tok, V))
return [=] { return V; };
// Tok is a symbol name.
- if (Tok != ".") {
- if (!isValidCIdentifier(Tok))
- setError("malformed number: " + Tok);
- Script->Opt.UndefinedSymbols.push_back(Tok);
- }
+ if (!isValidCIdentifier(Tok))
+ setError("malformed number: " + Tok);
+ Script->Opt.ReferencedSymbols.push_back(Tok);
return [=] { return Script->getSymbolValue(Location, Tok); };
}