<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Aug 7, 2015 at 1:07 PM, Rafael Espindola via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: rafael<br>
Date: Fri Aug 7 15:07:27 2015<br>
New Revision: 244351<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=244351&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=244351&view=rev</a><br>
Log:<br>
Remove the symbol iteration functions that don't take a symbol table.<br>
<br>
Another step in making ELFFile's constructor not iterate over all sections.<br></blockquote><div><br></div><div>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).</div><div><br></div><div>-- Sean Silva</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Modified:<br>
llvm/trunk/include/llvm/Object/ELF.h<br>
llvm/trunk/include/llvm/Object/ELFObjectFile.h<br>
llvm/trunk/tools/llvm-readobj/ARMEHABIPrinter.h<br>
llvm/trunk/tools/llvm-readobj/ELFDumper.cpp<br>
llvm/trunk/tools/obj2yaml/elf2yaml.cpp<br>
<br>
Modified: llvm/trunk/include/llvm/Object/ELF.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/ELF.h?rev=244351&r1=244350&r2=244351&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/ELF.h?rev=244351&r1=244350&r2=244351&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/Object/ELF.h (original)<br>
+++ llvm/trunk/include/llvm/Object/ELF.h Fri Aug 7 15:07:27 2015<br>
@@ -147,16 +147,6 @@ public:<br>
return make_range(symbol_begin(Sec), symbol_end(Sec));<br>
}<br>
<br>
- const Elf_Sym *symbol_begin() const { return symbol_begin(dot_symtab_sec); }<br>
- const Elf_Sym *symbol_end() const { return symbol_end(dot_symtab_sec); }<br>
- Elf_Sym_Range symbols() const { return symbols(dot_symtab_sec); }<br>
-<br>
- const Elf_Sym *dynamic_symbol_begin() const {<br>
- return symbol_begin(DotDynSymSec);<br>
- }<br>
- const Elf_Sym *dynamic_symbol_end() const { return symbol_end(DotDynSymSec); }<br>
- Elf_Sym_Range dynamic_symbols() const { return symbols(DotDynSymSec); }<br>
-<br>
typedef iterator_range<const Elf_Rela *> Elf_Rela_Range;<br>
<br>
const Elf_Rela *rela_begin(const Elf_Shdr *sec) const {<br>
@@ -235,7 +225,7 @@ template <class ELFT><br>
ELF::Elf64_Word<br>
ELFFile<ELFT>::getExtendedSymbolTableIndex(const Elf_Sym *Sym) const {<br>
assert(Sym->st_shndx == ELF::SHN_XINDEX);<br>
- unsigned Index = Sym - symbol_begin();<br>
+ unsigned Index = Sym - symbol_begin(dot_symtab_sec);<br>
<br>
// FIXME: error checking<br>
const Elf_Word *ShndxTable = reinterpret_cast<const Elf_Word *>(<br>
<br>
Modified: llvm/trunk/include/llvm/Object/ELFObjectFile.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/ELFObjectFile.h?rev=244351&r1=244350&r2=244351&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/ELFObjectFile.h?rev=244351&r1=244350&r2=244351&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/Object/ELFObjectFile.h (original)<br>
+++ llvm/trunk/include/llvm/Object/ELFObjectFile.h Fri Aug 7 15:07:27 2015<br>
@@ -474,7 +474,8 @@ uint32_t ELFObjectFile<ELFT>::getSymbolF<br>
Result |= SymbolRef::SF_Absolute;<br>
<br>
if (ESym->getType() == ELF::STT_FILE || ESym->getType() == ELF::STT_SECTION ||<br>
- ESym == EF.symbol_begin() || ESym == EF.dynamic_symbol_begin())<br>
+ ESym == EF.symbol_begin(EF.getDotSymtabSec()) ||<br>
+ ESym == EF.symbol_begin(EF.getDotDynSymSec()))<br>
Result |= SymbolRef::SF_FormatSpecific;<br>
<br>
if (EF.getHeader()->e_machine == ELF::EM_ARM) {<br>
<br>
Modified: llvm/trunk/tools/llvm-readobj/ARMEHABIPrinter.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/ARMEHABIPrinter.h?rev=244351&r1=244350&r2=244351&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/ARMEHABIPrinter.h?rev=244351&r1=244350&r2=244351&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/tools/llvm-readobj/ARMEHABIPrinter.h (original)<br>
+++ llvm/trunk/tools/llvm-readobj/ARMEHABIPrinter.h Fri Aug 7 15:07:27 2015<br>
@@ -349,7 +349,7 @@ PrinterContext<ET>::FunctionAtAddress(un<br>
error(StrTableOrErr.getError());<br>
StringRef StrTable = *StrTableOrErr;<br>
<br>
- for (const Elf_Sym &Sym : ELF->symbols())<br>
+ for (const Elf_Sym &Sym : ELF->symbols(ELF->getDotSymtabSec()))<br>
if (Sym.st_shndx == Section && Sym.st_value == Address &&<br>
Sym.getType() == ELF::STT_FUNC)<br>
return Sym.getName(StrTable);<br>
<br>
Modified: llvm/trunk/tools/llvm-readobj/ELFDumper.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/ELFDumper.cpp?rev=244351&r1=244350&r2=244351&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/ELFDumper.cpp?rev=244351&r1=244350&r2=244351&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/tools/llvm-readobj/ELFDumper.cpp (original)<br>
+++ llvm/trunk/tools/llvm-readobj/ELFDumper.cpp Fri Aug 7 15:07:27 2015<br>
@@ -995,7 +995,7 @@ void ELFDumper<ELFT>::printSections() {<br>
error(StrTableOrErr.getError());<br>
StringRef StrTable = *StrTableOrErr;<br>
<br>
- for (const Elf_Sym &Sym : Obj->symbols()) {<br>
+ for (const Elf_Sym &Sym : Obj->symbols(Symtab)) {<br>
ErrorOr<const Elf_Shdr *> SymSec = Obj->getSection(&Sym);<br>
if (!SymSec)<br>
continue;<br>
@@ -1126,7 +1126,7 @@ void ELFDumper<ELFT>::printSymbols() {<br>
ErrorOr<StringRef> StrTableOrErr = Obj->getStringTableForSymtab(*Symtab);<br>
error(StrTableOrErr.getError());<br>
StringRef StrTable = *StrTableOrErr;<br>
- for (const Elf_Sym &Sym : Obj->symbols())<br>
+ for (const Elf_Sym &Sym : Obj->symbols(Symtab))<br>
printSymbol(&Sym, StrTable, false);<br>
}<br>
<br>
<br>
Modified: llvm/trunk/tools/obj2yaml/elf2yaml.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/obj2yaml/elf2yaml.cpp?rev=244351&r1=244350&r2=244351&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/obj2yaml/elf2yaml.cpp?rev=244351&r1=244350&r2=244351&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/tools/obj2yaml/elf2yaml.cpp (original)<br>
+++ llvm/trunk/tools/obj2yaml/elf2yaml.cpp Fri Aug 7 15:07:27 2015<br>
@@ -129,7 +129,7 @@ ErrorOr<ELFYAML::Object *> ELFDumper<ELF<br>
StringRef StrTable = *StrTableOrErr;<br>
<br>
bool IsFirstSym = true;<br>
- for (const Elf_Sym &Sym : Obj.symbols()) {<br>
+ for (const Elf_Sym &Sym : Obj.symbols(Obj.getDotSymtabSec())) {<br>
if (IsFirstSym) {<br>
IsFirstSym = false;<br>
continue;<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div></div>