llvm.org GIT mirror llvm / 8081351
Remove the symbol iteration functions that don't take a symbol table. Another step in making ELFFile's constructor not iterate over all sections. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244351 91177308-0d34-0410-b5e6-96231b3b80d8 Rafael Espindola 5 years ago
5 changed file(s) with 7 addition(s) and 16 deletion(s). Raw diff Collapse all Expand all
146146 return make_range(symbol_begin(Sec), symbol_end(Sec));
147147 }
148148
149 const Elf_Sym *symbol_begin() const { return symbol_begin(dot_symtab_sec); }
150 const Elf_Sym *symbol_end() const { return symbol_end(dot_symtab_sec); }
151 Elf_Sym_Range symbols() const { return symbols(dot_symtab_sec); }
152
153 const Elf_Sym *dynamic_symbol_begin() const {
154 return symbol_begin(DotDynSymSec);
155 }
156 const Elf_Sym *dynamic_symbol_end() const { return symbol_end(DotDynSymSec); }
157 Elf_Sym_Range dynamic_symbols() const { return symbols(DotDynSymSec); }
158
159149 typedef iterator_range Elf_Rela_Range;
160150
161151 const Elf_Rela *rela_begin(const Elf_Shdr *sec) const {
234224 ELF::Elf64_Word
235225 ELFFile::getExtendedSymbolTableIndex(const Elf_Sym *Sym) const {
236226 assert(Sym->st_shndx == ELF::SHN_XINDEX);
237 unsigned Index = Sym - symbol_begin();
227 unsigned Index = Sym - symbol_begin(dot_symtab_sec);
238228
239229 // FIXME: error checking
240230 const Elf_Word *ShndxTable = reinterpret_cast(
473473 Result |= SymbolRef::SF_Absolute;
474474
475475 if (ESym->getType() == ELF::STT_FILE || ESym->getType() == ELF::STT_SECTION ||
476 ESym == EF.symbol_begin() || ESym == EF.dynamic_symbol_begin())
476 ESym == EF.symbol_begin(EF.getDotSymtabSec()) ||
477 ESym == EF.symbol_begin(EF.getDotDynSymSec()))
477478 Result |= SymbolRef::SF_FormatSpecific;
478479
479480 if (EF.getHeader()->e_machine == ELF::EM_ARM) {
348348 error(StrTableOrErr.getError());
349349 StringRef StrTable = *StrTableOrErr;
350350
351 for (const Elf_Sym &Sym : ELF->symbols())
351 for (const Elf_Sym &Sym : ELF->symbols(ELF->getDotSymtabSec()))
352352 if (Sym.st_shndx == Section && Sym.st_value == Address &&
353353 Sym.getType() == ELF::STT_FUNC)
354354 return Sym.getName(StrTable);
994994 error(StrTableOrErr.getError());
995995 StringRef StrTable = *StrTableOrErr;
996996
997 for (const Elf_Sym &Sym : Obj->symbols()) {
997 for (const Elf_Sym &Sym : Obj->symbols(Symtab)) {
998998 ErrorOr SymSec = Obj->getSection(&Sym);
999999 if (!SymSec)
10001000 continue;
11251125 ErrorOr StrTableOrErr = Obj->getStringTableForSymtab(*Symtab);
11261126 error(StrTableOrErr.getError());
11271127 StringRef StrTable = *StrTableOrErr;
1128 for (const Elf_Sym &Sym : Obj->symbols())
1128 for (const Elf_Sym &Sym : Obj->symbols(Symtab))
11291129 printSymbol(&Sym, StrTable, false);
11301130 }
11311131
128128 StringRef StrTable = *StrTableOrErr;
129129
130130 bool IsFirstSym = true;
131 for (const Elf_Sym &Sym : Obj.symbols()) {
131 for (const Elf_Sym &Sym : Obj.symbols(Obj.getDotSymtabSec())) {
132132 if (IsFirstSym) {
133133 IsFirstSym = false;
134134 continue;