[ELF] Move elf::symtab into Ctx

Remove the global variable `symtab` and add a member variable
(`std::unique_ptr<SymbolTable>`) to `Ctx` instead.

This is one step toward eliminating global states.

Pull Request: https://github.com/llvm/llvm-project/pull/109612
This commit is contained in:
Fangrui Song
2024-09-23 10:33:43 -07:00
parent 62f3eae466
commit df0864e761
17 changed files with 127 additions and 126 deletions

View File

@@ -1581,7 +1581,7 @@ Expr ScriptParser::readPrimary() {
// script, it must happen before this DEFINED.
auto order = ctx.scriptSymOrderCounter++;
return [=, &ctx = this->ctx] {
Symbol *s = symtab.find(name);
Symbol *s = ctx.symtab->find(name);
return s && s->isDefined() && ctx.scriptSymOrder.lookup(s) < order ? 1
: 0;
};