diff --git a/llvm/include/llvm/Object/ELF.h b/llvm/include/llvm/Object/ELF.h --- a/llvm/include/llvm/Object/ELF.h +++ b/llvm/include/llvm/Object/ELF.h @@ -388,8 +388,7 @@ Expected> getSectionContentsAsArray(const Elf_Shdr &Sec) const; Expected> getSectionContents(const Elf_Shdr &Sec) const; Expected> getSegmentContents(const Elf_Phdr &Phdr) const; - Expected> - decodeBBAddrMap(const Elf_Shdr &Sec) const; + Expected> decodeBBAddrMap(const Elf_Shdr &Sec) const; }; using ELF32LEFile = ELFFile; diff --git a/llvm/include/llvm/Object/ELFTypes.h b/llvm/include/llvm/Object/ELFTypes.h --- a/llvm/include/llvm/Object/ELFTypes.h +++ b/llvm/include/llvm/Object/ELFTypes.h @@ -44,7 +44,6 @@ template class Elf_Note_Impl; template class Elf_Note_Iterator_Impl; template struct Elf_CGProfile_Impl; -template struct Elf_BBAddrMap_Impl; template struct ELFType { private: @@ -76,7 +75,6 @@ using Note = Elf_Note_Impl>; using NoteIterator = Elf_Note_Iterator_Impl>; using CGProfile = Elf_CGProfile_Impl>; - using BBAddrMap = Elf_BBAddrMap_Impl>; using DynRange = ArrayRef; using ShdrRange = ArrayRef; using SymRange = ArrayRef; @@ -131,7 +129,6 @@ using Elf_Note = typename ELFT::Note; \ using Elf_Note_Iterator = typename ELFT::NoteIterator; \ using Elf_CGProfile = typename ELFT::CGProfile; \ - using Elf_BBAddrMap = typename ELFT::BBAddrMap; \ using Elf_Dyn_Range = typename ELFT::DynRange; \ using Elf_Shdr_Range = typename ELFT::ShdrRange; \ using Elf_Sym_Range = typename ELFT::SymRange; \ @@ -797,9 +794,8 @@ }; // Struct representing the BBAddrMap for one function. -template struct Elf_BBAddrMap_Impl { - LLVM_ELF_IMPORT_TYPES_ELFT(ELFT) - uintX_t Addr; // Function address +struct BBAddrMap { + uint64_t Addr; // Function address // Struct representing the BBAddrMap information for one basic block. struct BBEntry { uint32_t Offset; // Offset of basic block relative to function start. diff --git a/llvm/lib/Object/ELF.cpp b/llvm/lib/Object/ELF.cpp --- a/llvm/lib/Object/ELF.cpp +++ b/llvm/lib/Object/ELF.cpp @@ -622,14 +622,14 @@ } template -Expected> +Expected> ELFFile::decodeBBAddrMap(const Elf_Shdr &Sec) const { Expected> ContentsOrErr = getSectionContents(Sec); if (!ContentsOrErr) return ContentsOrErr.takeError(); ArrayRef Content = *ContentsOrErr; DataExtractor Data(Content, isLE(), ELFT::Is64Bits ? 8 : 4); - std::vector FunctionEntries; + std::vector FunctionEntries; DataExtractor::Cursor Cur(0); Error ULEBSizeErr = Error::success(); @@ -656,7 +656,7 @@ while (!ULEBSizeErr && Cur && Cur.tell() < Content.size()) { uintX_t Address = static_cast(Data.getAddress(Cur)); uint32_t NumBlocks = ReadULEB128AsUInt32(); - std::vector BBEntries; + std::vector BBEntries; for (uint32_t BlockID = 0; !ULEBSizeErr && Cur && (BlockID < NumBlocks); ++BlockID) { uint32_t Offset = ReadULEB128AsUInt32(); diff --git a/llvm/tools/llvm-readobj/ELFDumper.cpp b/llvm/tools/llvm-readobj/ELFDumper.cpp --- a/llvm/tools/llvm-readobj/ELFDumper.cpp +++ b/llvm/tools/llvm-readobj/ELFDumper.cpp @@ -6894,14 +6894,14 @@ FunctionSec = unwrapOrError(this->FileName, this->Obj.getSection(Sec.sh_link)); ListScope L(W, "BBAddrMap"); - Expected> BBAddrMapOrErr = + Expected> BBAddrMapOrErr = this->Obj.decodeBBAddrMap(Sec); if (!BBAddrMapOrErr) { this->reportUniqueWarning("unable to dump " + this->describe(Sec) + ": " + toString(BBAddrMapOrErr.takeError())); continue; } - for (const Elf_BBAddrMap &AM : *BBAddrMapOrErr) { + for (const BBAddrMap &AM : *BBAddrMapOrErr) { DictScope D(W, "Function"); W.printHex("At", AM.Addr); SmallVector FuncSymIndex = @@ -6916,7 +6916,7 @@ W.printString("Name", FuncName); ListScope L(W, "BB entries"); - for (const typename Elf_BBAddrMap::BBEntry &BBE : AM.BBEntries) { + for (const BBAddrMap::BBEntry &BBE : AM.BBEntries) { DictScope L(W); W.printHex("Offset", BBE.Offset); W.printHex("Size", BBE.Size);