diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp --- a/lld/ELF/Driver.cpp +++ b/lld/ELF/Driver.cpp @@ -1814,7 +1814,7 @@ // Calling sym->extract() in the loop is not safe because it may add new // symbols to the symbol table, invalidating the current iterator. SmallVector syms; - for (Symbol *sym : symtab->symbols()) + for (Symbol *sym : symtab->getSymbols()) if (!sym->isPlaceholder() && pat->match(sym->getName())) syms.push_back(sym); @@ -2000,7 +2000,7 @@ // --no-allow-shlib-undefined diagnostics. Similarly, demote lazy symbols. static void demoteSharedAndLazySymbols() { llvm::TimeTraceScope timeScope("Demote shared and lazy symbols"); - for (Symbol *sym : symtab->symbols()) { + for (Symbol *sym : symtab->getSymbols()) { auto *s = dyn_cast(sym); if (!(s && !cast(s->file)->isNeeded) && !sym->isLazy()) continue; @@ -2047,7 +2047,7 @@ // Symbols in the dynsym could be address-significant in other executables // or DSOs, so we conservatively mark them as address-significant. - for (Symbol *sym : symtab->symbols()) + for (Symbol *sym : symtab->getSymbols()) if (sym->includeInDynsym()) markAddrsig(sym); @@ -2305,7 +2305,7 @@ // symbols with a non-default version (foo@v1) and check whether it should be // combined with foo or foo@@v1. if (config->versionDefinitions.size() > 2) - for (Symbol *sym : symtab->symbols()) + for (Symbol *sym : symtab->getSymbols()) if (sym->hasVersionSuffix) combineVersionedSymbol(*sym, map); diff --git a/lld/ELF/ICF.cpp b/lld/ELF/ICF.cpp --- a/lld/ELF/ICF.cpp +++ b/lld/ELF/ICF.cpp @@ -460,7 +460,7 @@ // cannot be merged with the later computeIsPreemptible() pass which is used // by scanRelocations(). if (config->hasDynSymTab) - for (Symbol *sym : symtab->symbols()) + for (Symbol *sym : symtab->getSymbols()) sym->isPreemptible = computeIsPreemptible(*sym); // Two text sections may have identical content and relocations but different @@ -558,7 +558,7 @@ d->folded = true; } }; - for (Symbol *sym : symtab->symbols()) + for (Symbol *sym : symtab->getSymbols()) fold(sym); parallelForEach(ctx->objectFiles, [&](ELFFileBase *file) { for (Symbol *sym : file->getLocalSymbols()) diff --git a/lld/ELF/LTO.cpp b/lld/ELF/LTO.cpp --- a/lld/ELF/LTO.cpp +++ b/lld/ELF/LTO.cpp @@ -211,7 +211,7 @@ // Initialize usedStartStop. if (ctx->bitcodeFiles.empty()) return; - for (Symbol *sym : symtab->symbols()) { + for (Symbol *sym : symtab->getSymbols()) { if (sym->isPlaceholder()) continue; StringRef s = sym->getName(); diff --git a/lld/ELF/MarkLive.cpp b/lld/ELF/MarkLive.cpp --- a/lld/ELF/MarkLive.cpp +++ b/lld/ELF/MarkLive.cpp @@ -220,7 +220,7 @@ // Preserve externally-visible symbols if the symbols defined by this // file can interrupt other ELF file's symbols at runtime. - for (Symbol *sym : symtab->symbols()) + for (Symbol *sym : symtab->getSymbols()) if (sym->includeInDynsym() && sym->partition == partition) markSymbol(sym); @@ -361,7 +361,7 @@ // If --gc-sections is not given, retain all input sections. if (!config->gcSections) { // If a DSO defines a symbol referenced in a regular object, it is needed. - for (Symbol *sym : symtab->symbols()) + for (Symbol *sym : symtab->getSymbols()) if (auto *s = dyn_cast(sym)) if (s->isUsedInRegularObj && !s->isWeak()) cast(s->file)->isNeeded = true; diff --git a/lld/ELF/Relocations.cpp b/lld/ELF/Relocations.cpp --- a/lld/ELF/Relocations.cpp +++ b/lld/ELF/Relocations.cpp @@ -673,7 +673,7 @@ for (auto &it : map) if (name.equals_insensitive(it.first)) return it.second; - for (Symbol *sym : symtab->symbols()) + for (Symbol *sym : symtab->getSymbols()) if (!sym->isUndefined() && name.equals_insensitive(sym->getName())) return sym; @@ -699,7 +699,7 @@ break; } if (!s) - for (Symbol *sym : symtab->symbols()) + for (Symbol *sym : symtab->getSymbols()) if (canSuggestExternCForCXX(name, sym->getName())) { s = sym; break; @@ -1697,7 +1697,7 @@ } assert(symAux.empty()); - for (Symbol *sym : symtab->symbols()) + for (Symbol *sym : symtab->getSymbols()) fn(*sym); // Local symbols may need the aforementioned non-preemptible ifunc and GOT diff --git a/lld/ELF/SymbolTable.h b/lld/ELF/SymbolTable.h --- a/lld/ELF/SymbolTable.h +++ b/lld/ELF/SymbolTable.h @@ -33,7 +33,7 @@ // is one add* function per symbol type. class SymbolTable { public: - ArrayRef symbols() const { return symVector; } + ArrayRef getSymbols() const { return symVector; } void wrap(Symbol *sym, Symbol *real, Symbol *wrap); diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -1270,7 +1270,7 @@ // We want both global and local symbols. We get the global ones from the // symbol table and iterate the object files for the local ones. - for (Symbol *sym : symtab->symbols()) + for (Symbol *sym : symtab->getSymbols()) addSym(*sym); for (ELFFileBase *file : ctx->objectFiles) @@ -1886,7 +1886,7 @@ } if (config->hasDynSymTab) { - parallelForEach(symtab->symbols(), [](Symbol *sym) { + parallelForEach(symtab->getSymbols(), [](Symbol *sym) { sym->isPreemptible = computeIsPreemptible(*sym); }); } @@ -1958,7 +1958,7 @@ llvm::TimeTraceScope timeScope("Add symbols to symtabs"); // Now that we have defined all possible global symbols including linker- // synthesized ones. Visit all symbols to give the finishing touches. - for (Symbol *sym : symtab->symbols()) { + for (Symbol *sym : symtab->getSymbols()) { if (!sym->isUsedInRegularObj || !includeInSymtab(*sym)) continue; if (!config->relocatable)