[llvm] r244351 - Remove the symbol iteration functions that don't take a symbol table.

Sean Silva via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 7 23:23:33 PDT 2015


On Fri, Aug 7, 2015 at 1:07 PM, Rafael Espindola via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: rafael
> Date: Fri Aug  7 15:07:27 2015
> New Revision: 244351
>
> URL: http://llvm.org/viewvc/llvm-project?rev=244351&view=rev
> Log:
> Remove the symbol iteration functions that don't take a symbol table.
>
> Another step in making ELFFile's constructor not iterate over all sections.
>

Thanks for keeping us up to date on what the patch set you're working on is
working towards! Sometimes I forget (or it's not obvious that it that a
given patch relates).

-- Sean Silva


>
> Modified:
>     llvm/trunk/include/llvm/Object/ELF.h
>     llvm/trunk/include/llvm/Object/ELFObjectFile.h
>     llvm/trunk/tools/llvm-readobj/ARMEHABIPrinter.h
>     llvm/trunk/tools/llvm-readobj/ELFDumper.cpp
>     llvm/trunk/tools/obj2yaml/elf2yaml.cpp
>
> Modified: llvm/trunk/include/llvm/Object/ELF.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/ELF.h?rev=244351&r1=244350&r2=244351&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/Object/ELF.h (original)
> +++ llvm/trunk/include/llvm/Object/ELF.h Fri Aug  7 15:07:27 2015
> @@ -147,16 +147,6 @@ public:
>      return make_range(symbol_begin(Sec), symbol_end(Sec));
>    }
>
> -  const Elf_Sym *symbol_begin() const { return
> symbol_begin(dot_symtab_sec); }
> -  const Elf_Sym *symbol_end() const { return symbol_end(dot_symtab_sec); }
> -  Elf_Sym_Range symbols() const { return symbols(dot_symtab_sec); }
> -
> -  const Elf_Sym *dynamic_symbol_begin() const {
> -    return symbol_begin(DotDynSymSec);
> -  }
> -  const Elf_Sym *dynamic_symbol_end() const { return
> symbol_end(DotDynSymSec); }
> -  Elf_Sym_Range dynamic_symbols() const { return symbols(DotDynSymSec); }
> -
>    typedef iterator_range<const Elf_Rela *> Elf_Rela_Range;
>
>    const Elf_Rela *rela_begin(const Elf_Shdr *sec) const {
> @@ -235,7 +225,7 @@ template <class ELFT>
>  ELF::Elf64_Word
>  ELFFile<ELFT>::getExtendedSymbolTableIndex(const Elf_Sym *Sym) const {
>    assert(Sym->st_shndx == ELF::SHN_XINDEX);
> -  unsigned Index = Sym - symbol_begin();
> +  unsigned Index = Sym - symbol_begin(dot_symtab_sec);
>
>    // FIXME: error checking
>    const Elf_Word *ShndxTable = reinterpret_cast<const Elf_Word *>(
>
> Modified: llvm/trunk/include/llvm/Object/ELFObjectFile.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/ELFObjectFile.h?rev=244351&r1=244350&r2=244351&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/Object/ELFObjectFile.h (original)
> +++ llvm/trunk/include/llvm/Object/ELFObjectFile.h Fri Aug  7 15:07:27 2015
> @@ -474,7 +474,8 @@ uint32_t ELFObjectFile<ELFT>::getSymbolF
>      Result |= SymbolRef::SF_Absolute;
>
>    if (ESym->getType() == ELF::STT_FILE || ESym->getType() ==
> ELF::STT_SECTION ||
> -      ESym == EF.symbol_begin() || ESym == EF.dynamic_symbol_begin())
> +      ESym == EF.symbol_begin(EF.getDotSymtabSec()) ||
> +      ESym == EF.symbol_begin(EF.getDotDynSymSec()))
>      Result |= SymbolRef::SF_FormatSpecific;
>
>    if (EF.getHeader()->e_machine == ELF::EM_ARM) {
>
> Modified: llvm/trunk/tools/llvm-readobj/ARMEHABIPrinter.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/ARMEHABIPrinter.h?rev=244351&r1=244350&r2=244351&view=diff
>
> ==============================================================================
> --- llvm/trunk/tools/llvm-readobj/ARMEHABIPrinter.h (original)
> +++ llvm/trunk/tools/llvm-readobj/ARMEHABIPrinter.h Fri Aug  7 15:07:27
> 2015
> @@ -349,7 +349,7 @@ PrinterContext<ET>::FunctionAtAddress(un
>    error(StrTableOrErr.getError());
>    StringRef StrTable = *StrTableOrErr;
>
> -  for (const Elf_Sym &Sym : ELF->symbols())
> +  for (const Elf_Sym &Sym : ELF->symbols(ELF->getDotSymtabSec()))
>      if (Sym.st_shndx == Section && Sym.st_value == Address &&
>          Sym.getType() == ELF::STT_FUNC)
>        return Sym.getName(StrTable);
>
> Modified: llvm/trunk/tools/llvm-readobj/ELFDumper.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/ELFDumper.cpp?rev=244351&r1=244350&r2=244351&view=diff
>
> ==============================================================================
> --- llvm/trunk/tools/llvm-readobj/ELFDumper.cpp (original)
> +++ llvm/trunk/tools/llvm-readobj/ELFDumper.cpp Fri Aug  7 15:07:27 2015
> @@ -995,7 +995,7 @@ void ELFDumper<ELFT>::printSections() {
>        error(StrTableOrErr.getError());
>        StringRef StrTable = *StrTableOrErr;
>
> -      for (const Elf_Sym &Sym : Obj->symbols()) {
> +      for (const Elf_Sym &Sym : Obj->symbols(Symtab)) {
>          ErrorOr<const Elf_Shdr *> SymSec = Obj->getSection(&Sym);
>          if (!SymSec)
>            continue;
> @@ -1126,7 +1126,7 @@ void ELFDumper<ELFT>::printSymbols() {
>    ErrorOr<StringRef> StrTableOrErr =
> Obj->getStringTableForSymtab(*Symtab);
>    error(StrTableOrErr.getError());
>    StringRef StrTable = *StrTableOrErr;
> -  for (const Elf_Sym &Sym : Obj->symbols())
> +  for (const Elf_Sym &Sym : Obj->symbols(Symtab))
>      printSymbol(&Sym, StrTable, false);
>  }
>
>
> Modified: llvm/trunk/tools/obj2yaml/elf2yaml.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/obj2yaml/elf2yaml.cpp?rev=244351&r1=244350&r2=244351&view=diff
>
> ==============================================================================
> --- llvm/trunk/tools/obj2yaml/elf2yaml.cpp (original)
> +++ llvm/trunk/tools/obj2yaml/elf2yaml.cpp Fri Aug  7 15:07:27 2015
> @@ -129,7 +129,7 @@ ErrorOr<ELFYAML::Object *> ELFDumper<ELF
>    StringRef StrTable = *StrTableOrErr;
>
>    bool IsFirstSym = true;
> -  for (const Elf_Sym &Sym : Obj.symbols()) {
> +  for (const Elf_Sym &Sym : Obj.symbols(Obj.getDotSymtabSec())) {
>      if (IsFirstSym) {
>        IsFirstSym = false;
>        continue;
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150807/4c6916ab/attachment.html>


More information about the llvm-commits mailing list