diff --git a/llvm/include/llvm/Object/ELF.h b/llvm/include/llvm/Object/ELF.h index b7af7795b8c9..37f23c435ae1 100644 --- a/llvm/include/llvm/Object/ELF.h +++ b/llvm/include/llvm/Object/ELF.h @@ -388,8 +388,7 @@ public: 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 index 54ebd751d8d2..e59a63d93989 100644 --- a/llvm/include/llvm/Object/ELFTypes.h +++ b/llvm/include/llvm/Object/ELFTypes.h @@ -44,7 +44,6 @@ template struct Elf_Nhdr_Impl; 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 @@ public: 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 ELF64BE = ELFType; 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 @@ template struct Elf_Mips_ABIFlags { }; // 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 index 1eabc29ac5d4..84181ae5e501 100644 --- a/llvm/lib/Object/ELF.cpp +++ b/llvm/lib/Object/ELF.cpp @@ -622,14 +622,14 @@ ELFFile::toMappedAddr(uint64_t VAddr, WarningHandler WarnHandler) const { } 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 @@ ELFFile::decodeBBAddrMap(const Elf_Shdr &Sec) const { 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 index a62eae87197c..855d3f3488fa 100644 --- a/llvm/tools/llvm-readobj/ELFDumper.cpp +++ b/llvm/tools/llvm-readobj/ELFDumper.cpp @@ -6894,14 +6894,14 @@ template void LLVMELFDumper::printBBAddrMaps() { 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 @@ template void LLVMELFDumper::printBBAddrMaps() { 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);