mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 04:30:23 +00:00
[Object][ELF] Range-based loop simplification.
No functional changes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210164 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
3b3d2e2c3a
commit
d126407627
@ -133,6 +133,7 @@ public:
|
||||
typedef Elf_Vernaux_Impl<ELFT> Elf_Vernaux;
|
||||
typedef Elf_Versym_Impl<ELFT> Elf_Versym;
|
||||
typedef ELFEntityIterator<const Elf_Dyn> Elf_Dyn_Iter;
|
||||
typedef iterator_range<Elf_Dyn_Iter> Elf_Dyn_Range;
|
||||
typedef ELFEntityIterator<const Elf_Rela> Elf_Rela_Iter;
|
||||
typedef ELFEntityIterator<const Elf_Rel> Elf_Rel_Iter;
|
||||
typedef ELFEntityIterator<const Elf_Shdr> Elf_Shdr_Iter;
|
||||
@ -342,6 +343,9 @@ public:
|
||||
/// \param NULLEnd use one past the first DT_NULL entry as the end instead of
|
||||
/// the section size.
|
||||
Elf_Dyn_Iter end_dynamic_table(bool NULLEnd = false) const;
|
||||
Elf_Dyn_Range dynamic_table(bool NULLEnd = false) const {
|
||||
return make_range(begin_dynamic_table(), end_dynamic_table(NULLEnd));
|
||||
}
|
||||
|
||||
Elf_Sym_Iter begin_dynamic_symbols() const {
|
||||
if (DynSymRegion.Addr)
|
||||
@ -823,17 +827,13 @@ ELFFile<ELFT>::end_dynamic_table(bool NULLEnd) const {
|
||||
template <class ELFT>
|
||||
StringRef ELFFile<ELFT>::getLoadName() const {
|
||||
if (!dt_soname) {
|
||||
dt_soname = "";
|
||||
// Find the DT_SONAME entry
|
||||
Elf_Dyn_Iter it = begin_dynamic_table();
|
||||
Elf_Dyn_Iter ie = end_dynamic_table();
|
||||
while (it != ie && it->getTag() != ELF::DT_SONAME)
|
||||
++it;
|
||||
|
||||
if (it != ie) {
|
||||
dt_soname = getDynamicString(it->getVal());
|
||||
} else {
|
||||
dt_soname = "";
|
||||
}
|
||||
for (const auto &Entry : dynamic_table())
|
||||
if (Entry.getTag() == ELF::DT_SONAME) {
|
||||
dt_soname = getDynamicString(Entry.getVal());
|
||||
break;
|
||||
}
|
||||
}
|
||||
return dt_soname;
|
||||
}
|
||||
|
@ -902,13 +902,12 @@ void ELFDumper<ELFType<support::little, 2, false> >::printUnwindInfo() {
|
||||
|
||||
template<class ELFT>
|
||||
void ELFDumper<ELFT>::printDynamicTable() {
|
||||
typedef typename ELFO::Elf_Dyn_Iter EDI;
|
||||
EDI Start = Obj->begin_dynamic_table(), End = Obj->end_dynamic_table(true);
|
||||
auto DynTable = Obj->dynamic_table(true);
|
||||
|
||||
if (Start == End)
|
||||
ptrdiff_t Total = std::distance(DynTable.begin(), DynTable.end());
|
||||
if (Total == 0)
|
||||
return;
|
||||
|
||||
ptrdiff_t Total = std::distance(Start, End);
|
||||
raw_ostream &OS = W.getOStream();
|
||||
W.startLine() << "DynamicSection [ (" << Total << " entries)\n";
|
||||
|
||||
@ -917,12 +916,12 @@ void ELFDumper<ELFT>::printDynamicTable() {
|
||||
W.startLine()
|
||||
<< " Tag" << (Is64 ? " " : " ") << "Type"
|
||||
<< " " << "Name/Value\n";
|
||||
for (; Start != End; ++Start) {
|
||||
for (const auto &Entry : DynTable) {
|
||||
W.startLine()
|
||||
<< " "
|
||||
<< format(Is64 ? "0x%016" PRIX64 : "0x%08" PRIX64, Start->getTag())
|
||||
<< " " << format("%-21s", getTypeString(Start->getTag()));
|
||||
printValue(Obj, Start->getTag(), Start->getVal(), Is64, OS);
|
||||
<< format(Is64 ? "0x%016" PRIX64 : "0x%08" PRIX64, Entry.getTag())
|
||||
<< " " << format("%-21s", getTypeString(Entry.getTag()));
|
||||
printValue(Obj, Entry.getTag(), Entry.getVal(), Is64, OS);
|
||||
OS << "\n";
|
||||
}
|
||||
|
||||
@ -936,11 +935,9 @@ void ELFDumper<ELFT>::printNeededLibraries() {
|
||||
typedef std::vector<StringRef> LibsTy;
|
||||
LibsTy Libs;
|
||||
|
||||
for (typename ELFO::Elf_Dyn_Iter DynI = Obj->begin_dynamic_table(),
|
||||
DynE = Obj->end_dynamic_table();
|
||||
DynI != DynE; ++DynI)
|
||||
if (DynI->d_tag == ELF::DT_NEEDED)
|
||||
Libs.push_back(Obj->getDynamicString(DynI->d_un.d_val));
|
||||
for (const auto &Entry : Obj->dynamic_table())
|
||||
if (Entry.d_tag == ELF::DT_NEEDED)
|
||||
Libs.push_back(Obj->getDynamicString(Entry.d_un.d_val));
|
||||
|
||||
std::stable_sort(Libs.begin(), Libs.end());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user