// Calling sym->extract() in the loop is not safe because it may add new
// symbols to the symbol table, invalidating the current iterator.
SmallVector<Symbol *, 0> syms;
- for (Symbol *sym : symtab->symbols())
+ for (Symbol *sym : symtab->getSymbols())
if (!sym->isPlaceholder() && pat->match(sym->getName()))
syms.push_back(sym);
// --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<SharedSymbol>(sym);
if (!(s && !cast<SharedFile>(s->file)->isNeeded) && !sym->isLazy())
continue;
// 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);
// 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);
// 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
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())
// 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();
// 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);
// 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<SharedSymbol>(sym))
if (s->isUsedInRegularObj && !s->isWeak())
cast<SharedFile>(s->file)->isNeeded = true;
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;
break;
}
if (!s)
- for (Symbol *sym : symtab->symbols())
+ for (Symbol *sym : symtab->getSymbols())
if (canSuggestExternCForCXX(name, sym->getName())) {
s = sym;
break;
}
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
// is one add* function per symbol type.
class SymbolTable {
public:
- ArrayRef<Symbol *> symbols() const { return symVector; }
+ ArrayRef<Symbol *> getSymbols() const { return symVector; }
void wrap(Symbol *sym, Symbol *real, Symbol *wrap);
// 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)
}
if (config->hasDynSymTab) {
- parallelForEach(symtab->symbols(), [](Symbol *sym) {
+ parallelForEach(symtab->getSymbols(), [](Symbol *sym) {
sym->isPreemptible = computeIsPreemptible(*sym);
});
}
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)