aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm/tools/llvm-objdump/ELFDump.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm/tools/llvm-objdump/ELFDump.cpp')
-rw-r--r--contrib/llvm/tools/llvm-objdump/ELFDump.cpp32
1 files changed, 12 insertions, 20 deletions
diff --git a/contrib/llvm/tools/llvm-objdump/ELFDump.cpp b/contrib/llvm/tools/llvm-objdump/ELFDump.cpp
index 2d0d7d7db0f3..7b44e3916c48 100644
--- a/contrib/llvm/tools/llvm-objdump/ELFDump.cpp
+++ b/contrib/llvm/tools/llvm-objdump/ELFDump.cpp
@@ -24,10 +24,8 @@ using namespace llvm::object;
template <class ELFT> void printProgramHeaders(const ELFFile<ELFT> *o) {
typedef ELFFile<ELFT> ELFO;
outs() << "Program Header:\n";
- for (typename ELFO::Elf_Phdr_Iter pi = o->program_header_begin(),
- pe = o->program_header_end();
- pi != pe; ++pi) {
- switch (pi->p_type) {
+ for (const typename ELFO::Elf_Phdr &Phdr : o->program_headers()) {
+ switch (Phdr.p_type) {
case ELF::PT_LOAD:
outs() << " LOAD ";
break;
@@ -55,22 +53,16 @@ template <class ELFT> void printProgramHeaders(const ELFFile<ELFT> *o) {
const char *Fmt = ELFT::Is64Bits ? "0x%016" PRIx64 " " : "0x%08" PRIx64 " ";
- outs() << "off "
- << format(Fmt, (uint64_t)pi->p_offset)
- << "vaddr "
- << format(Fmt, (uint64_t)pi->p_vaddr)
- << "paddr "
- << format(Fmt, (uint64_t)pi->p_paddr)
- << format("align 2**%u\n", countTrailingZeros<uint64_t>(pi->p_align))
- << " filesz "
- << format(Fmt, (uint64_t)pi->p_filesz)
- << "memsz "
- << format(Fmt, (uint64_t)pi->p_memsz)
- << "flags "
- << ((pi->p_flags & ELF::PF_R) ? "r" : "-")
- << ((pi->p_flags & ELF::PF_W) ? "w" : "-")
- << ((pi->p_flags & ELF::PF_X) ? "x" : "-")
- << "\n";
+ outs() << "off " << format(Fmt, (uint64_t)Phdr.p_offset) << "vaddr "
+ << format(Fmt, (uint64_t)Phdr.p_vaddr) << "paddr "
+ << format(Fmt, (uint64_t)Phdr.p_paddr)
+ << format("align 2**%u\n",
+ countTrailingZeros<uint64_t>(Phdr.p_align))
+ << " filesz " << format(Fmt, (uint64_t)Phdr.p_filesz)
+ << "memsz " << format(Fmt, (uint64_t)Phdr.p_memsz) << "flags "
+ << ((Phdr.p_flags & ELF::PF_R) ? "r" : "-")
+ << ((Phdr.p_flags & ELF::PF_W) ? "w" : "-")
+ << ((Phdr.p_flags & ELF::PF_X) ? "x" : "-") << "\n";
}
outs() << "\n";
}