From aaf1f3612ec5aeeee6edefd293c294e33ecefc08 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Sun, 7 Apr 2019 08:29:04 +0000 Subject: [PATCH] [llvm-objdump] Simplify some ELF typename: ELFFile::Elf_xxx -> ELFT::xxx git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@357857 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/llvm-objdump/ELFDump.cpp | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/tools/llvm-objdump/ELFDump.cpp b/tools/llvm-objdump/ELFDump.cpp index 3b293a75f08..4144b0c12d9 100644 --- a/tools/llvm-objdump/ELFDump.cpp +++ b/tools/llvm-objdump/ELFDump.cpp @@ -53,8 +53,6 @@ template static std::error_code getRelocationValueString(const ELFObjectFile *Obj, const RelocationRef &RelRef, SmallVectorImpl &Result) { - typedef typename ELFObjectFile::Elf_Rela Elf_Rela; - const ELFFile &EF = *Obj->getELFFile(); DataRefImpl Rel = RelRef.getRawDataRefImpl(); auto SecOrErr = EF.getSection(Rel.d.a); @@ -70,7 +68,7 @@ static std::error_code getRelocationValueString(const ELFObjectFile *Obj, // GNU objdump does not do that and we just follow for simplicity atm. bool Undef = false; if ((*SecOrErr)->sh_type == ELF::SHT_RELA) { - const Elf_Rela *ERela = Obj->getRela(Rel); + const typename ELFT::Rela *ERela = Obj->getRela(Rel); Addend = ERela->r_addend; Undef = ERela->getSymbol(false) == 0; } else if ((*SecOrErr)->sh_type != ELF::SHT_REL) { @@ -138,7 +136,7 @@ static uint64_t getSectionLMA(const ELFFile *Obj, // Search for a PT_LOAD segment containing the requested section. Use this // segment's p_addr to calculate the section's LMA. - for (const typename ELFFile::Elf_Phdr &Phdr : *PhdrRangeOrErr) + for (const typename ELFT::Phdr &Phdr : *PhdrRangeOrErr) if ((Phdr.p_type == ELF::PT_LOAD) && (Phdr.p_vaddr <= Sec.getAddress()) && (Phdr.p_vaddr + Phdr.p_memsz > Sec.getAddress())) return Sec.getAddress() - Phdr.p_vaddr + Phdr.p_paddr; @@ -281,10 +279,6 @@ template void printSymbolVersionDefinition(const typename ELFT::Shdr &Shdr, ArrayRef Contents, StringRef StrTab) { - typedef ELFFile ELFO; - typedef typename ELFO::Elf_Verdef Elf_Verdef; - typedef typename ELFO::Elf_Verdaux Elf_Verdaux; - outs() << "Version definitions:\n"; const uint8_t *Buf = Contents.data(); @@ -294,7 +288,7 @@ void printSymbolVersionDefinition(const typename ELFT::Shdr &Shdr, // according to sh_info. uint16_t VerdefIndexWidth = std::to_string(Shdr.sh_info).size(); while (Buf) { - const Elf_Verdef *Verdef = reinterpret_cast(Buf); + auto *Verdef = reinterpret_cast(Buf); outs() << format_decimal(VerdefIndex++, VerdefIndexWidth) << " " << format("0x%02" PRIx16 " ", (uint16_t)Verdef->vd_flags) << format("0x%08" PRIx32 " ", (uint32_t)Verdef->vd_hash); @@ -302,8 +296,7 @@ void printSymbolVersionDefinition(const typename ELFT::Shdr &Shdr, const uint8_t *BufAux = Buf + Verdef->vd_aux; uint16_t VerdauxIndex = 0; while (BufAux) { - const Elf_Verdaux *Verdaux = - reinterpret_cast(BufAux); + auto *Verdaux = reinterpret_cast(BufAux); if (VerdauxIndex) outs() << std::string(VerdefIndexWidth + 17, ' '); outs() << StringRef(StrTab.drop_front(Verdaux->vda_name).data()) << '\n'; -- 2.40.0