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 @@ -90,32 +90,6 @@ class ELFFile { public: LLVM_ELF_IMPORT_TYPES_ELFT(ELFT) - using uintX_t = typename ELFT::uint; - using Elf_Ehdr = typename ELFT::Ehdr; - using Elf_Shdr = typename ELFT::Shdr; - using Elf_Sym = typename ELFT::Sym; - using Elf_Dyn = typename ELFT::Dyn; - using Elf_Phdr = typename ELFT::Phdr; - using Elf_Rel = typename ELFT::Rel; - using Elf_Rela = typename ELFT::Rela; - using Elf_Relr = typename ELFT::Relr; - using Elf_Verdef = typename ELFT::Verdef; - using Elf_Verdaux = typename ELFT::Verdaux; - using Elf_Verneed = typename ELFT::Verneed; - using Elf_Vernaux = typename ELFT::Vernaux; - using Elf_Versym = typename ELFT::Versym; - using Elf_Hash = typename ELFT::Hash; - using Elf_GnuHash = typename ELFT::GnuHash; - using Elf_Nhdr = typename ELFT::Nhdr; - using Elf_Note = typename ELFT::Note; - using Elf_Note_Iterator = typename ELFT::NoteIterator; - using Elf_Dyn_Range = typename ELFT::DynRange; - using Elf_Shdr_Range = typename ELFT::ShdrRange; - using Elf_Sym_Range = typename ELFT::SymRange; - using Elf_Rel_Range = typename ELFT::RelRange; - using Elf_Rela_Range = typename ELFT::RelaRange; - using Elf_Relr_Range = typename ELFT::RelrRange; - using Elf_Phdr_Range = typename ELFT::PhdrRange; // This is a callback that can be passed to a number of functions. // It can be used to ignore non-critical errors (warnings), which is diff --git a/llvm/include/llvm/Object/ELFObjectFile.h b/llvm/include/llvm/Object/ELFObjectFile.h --- a/llvm/include/llvm/Object/ELFObjectFile.h +++ b/llvm/include/llvm/Object/ELFObjectFile.h @@ -233,15 +233,6 @@ public: LLVM_ELF_IMPORT_TYPES_ELFT(ELFT) - using uintX_t = typename ELFT::uint; - - using Elf_Sym = typename ELFT::Sym; - using Elf_Shdr = typename ELFT::Shdr; - using Elf_Ehdr = typename ELFT::Ehdr; - using Elf_Rel = typename ELFT::Rel; - using Elf_Rela = typename ELFT::Rela; - using Elf_Dyn = typename ELFT::Dyn; - SectionRef toSectionRef(const Elf_Shdr *Sec) const { return SectionRef(toDRI(Sec), this); } 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 @@ -107,7 +107,34 @@ using Elf_Word = typename ELFT::Word; \ using Elf_Sword = typename ELFT::Sword; \ using Elf_Xword = typename ELFT::Xword; \ - using Elf_Sxword = typename ELFT::Sxword; + using Elf_Sxword = typename ELFT::Sxword; \ + using uintX_t = typename ELFT::uint; \ + using Elf_Ehdr = typename ELFT::Ehdr; \ + using Elf_Shdr = typename ELFT::Shdr; \ + using Elf_Sym = typename ELFT::Sym; \ + using Elf_Dyn = typename ELFT::Dyn; \ + using Elf_Phdr = typename ELFT::Phdr; \ + using Elf_Rel = typename ELFT::Rel; \ + using Elf_Rela = typename ELFT::Rela; \ + using Elf_Relr = typename ELFT::Relr; \ + using Elf_Verdef = typename ELFT::Verdef; \ + using Elf_Verdaux = typename ELFT::Verdaux; \ + using Elf_Verneed = typename ELFT::Verneed; \ + using Elf_Vernaux = typename ELFT::Vernaux; \ + using Elf_Versym = typename ELFT::Versym; \ + using Elf_Hash = typename ELFT::Hash; \ + using Elf_GnuHash = typename ELFT::GnuHash; \ + using Elf_Nhdr = typename ELFT::Nhdr; \ + using Elf_Note = typename ELFT::Note; \ + using Elf_Note_Iterator = typename ELFT::NoteIterator; \ + using Elf_CGProfile = typename ELFT::CGProfile; \ + using Elf_Dyn_Range = typename ELFT::DynRange; \ + using Elf_Shdr_Range = typename ELFT::ShdrRange; \ + using Elf_Sym_Range = typename ELFT::SymRange; \ + using Elf_Rel_Range = typename ELFT::RelRange; \ + using Elf_Rela_Range = typename ELFT::RelaRange; \ + using Elf_Relr_Range = typename ELFT::RelrRange; \ + using Elf_Phdr_Range = typename ELFT::PhdrRange; \ #define LLVM_ELF_COMMA , #define LLVM_ELF_IMPORT_TYPES(E, W) \ @@ -269,7 +296,6 @@ template struct Elf_Verdef_Impl { LLVM_ELF_IMPORT_TYPES_ELFT(ELFT) - using Elf_Verdaux = Elf_Verdaux_Impl; Elf_Half vd_version; // Version of this structure (e.g. VER_DEF_CURRENT) Elf_Half vd_flags; // Bitwise flags (VER_DEF_*) Elf_Half vd_ndx; // Version index, used in .gnu.version entries diff --git a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp --- a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp +++ b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp @@ -57,13 +57,6 @@ template class DyldELFObject : public ELFObjectFile { LLVM_ELF_IMPORT_TYPES_ELFT(ELFT) - typedef Elf_Shdr_Impl Elf_Shdr; - typedef Elf_Sym_Impl Elf_Sym; - typedef Elf_Rel_Impl Elf_Rel; - typedef Elf_Rel_Impl Elf_Rela; - - typedef Elf_Ehdr_Impl Elf_Ehdr; - typedef typename ELFT::uint addr_type; DyldELFObject(ELFObjectFile &&Obj); diff --git a/llvm/lib/ObjectYAML/ELFEmitter.cpp b/llvm/lib/ObjectYAML/ELFEmitter.cpp --- a/llvm/lib/ObjectYAML/ELFEmitter.cpp +++ b/llvm/lib/ObjectYAML/ELFEmitter.cpp @@ -168,15 +168,7 @@ /// TODO: This class still has a ways to go before it is truly a "single /// point of truth". template class ELFState { - typedef typename ELFT::Ehdr Elf_Ehdr; - typedef typename ELFT::Phdr Elf_Phdr; - typedef typename ELFT::Shdr Elf_Shdr; - typedef typename ELFT::Sym Elf_Sym; - typedef typename ELFT::Rel Elf_Rel; - typedef typename ELFT::Rela Elf_Rela; - typedef typename ELFT::Relr Elf_Relr; - typedef typename ELFT::Dyn Elf_Dyn; - typedef typename ELFT::uint uintX_t; + LLVM_ELF_IMPORT_TYPES_ELFT(ELFT) enum class SymtabType { Static, Dynamic }; @@ -1477,9 +1469,6 @@ void ELFState::writeSectionContent(Elf_Shdr &SHeader, const ELFYAML::VerdefSection &Section, ContiguousBlobAccumulator &CBA) { - typedef typename ELFT::Verdef Elf_Verdef; - typedef typename ELFT::Verdaux Elf_Verdaux; - SHeader.sh_info = Section.Info; if (!Section.Entries) @@ -1522,9 +1511,6 @@ void ELFState::writeSectionContent(Elf_Shdr &SHeader, const ELFYAML::VerneedSection &Section, ContiguousBlobAccumulator &CBA) { - typedef typename ELFT::Verneed Elf_Verneed; - typedef typename ELFT::Vernaux Elf_Vernaux; - SHeader.sh_info = Section.Info; if (!Section.VerneedV) 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 @@ -80,35 +80,6 @@ #define ENUM_ENT_1(enum) \ { #enum, #enum, ELF::enum } -#define TYPEDEF_ELF_TYPES(ELFT) \ - using ELFO = ELFFile; \ - using Elf_Addr = typename ELFT::Addr; \ - using Elf_Shdr = typename ELFT::Shdr; \ - using Elf_Sym = typename ELFT::Sym; \ - using Elf_Dyn = typename ELFT::Dyn; \ - using Elf_Dyn_Range = typename ELFT::DynRange; \ - using Elf_Rel = typename ELFT::Rel; \ - using Elf_Rela = typename ELFT::Rela; \ - using Elf_Relr = typename ELFT::Relr; \ - using Elf_Rel_Range = typename ELFT::RelRange; \ - using Elf_Rela_Range = typename ELFT::RelaRange; \ - using Elf_Relr_Range = typename ELFT::RelrRange; \ - using Elf_Phdr = typename ELFT::Phdr; \ - using Elf_Half = typename ELFT::Half; \ - using Elf_Ehdr = typename ELFT::Ehdr; \ - using Elf_Word = typename ELFT::Word; \ - using Elf_Hash = typename ELFT::Hash; \ - using Elf_GnuHash = typename ELFT::GnuHash; \ - using Elf_Note = typename ELFT::Note; \ - using Elf_Sym_Range = typename ELFT::SymRange; \ - using Elf_Versym = typename ELFT::Versym; \ - using Elf_Verneed = typename ELFT::Verneed; \ - using Elf_Vernaux = typename ELFT::Vernaux; \ - using Elf_Verdef = typename ELFT::Verdef; \ - using Elf_Verdaux = typename ELFT::Verdaux; \ - using Elf_CGProfile = typename ELFT::CGProfile; \ - using uintX_t = typename ELFT::uint; - namespace { template class DumpStyle; @@ -304,7 +275,7 @@ private: std::unique_ptr> ELFDumperStyle; - TYPEDEF_ELF_TYPES(ELFT) + LLVM_ELF_IMPORT_TYPES_ELFT(ELFT) Expected createDRI(uint64_t Offset, uint64_t Size, uint64_t EntSize) { @@ -750,7 +721,7 @@ template class DumpStyle { public: - TYPEDEF_ELF_TYPES(ELFT) + LLVM_ELF_IMPORT_TYPES_ELFT(ELFT) DumpStyle(const ELFDumper &Dumper) : Obj(Dumper.getElfObject().getELFFile()), ElfObj(Dumper.getElfObject()), @@ -840,7 +811,7 @@ formatted_raw_ostream &OS; public: - TYPEDEF_ELF_TYPES(ELFT) + LLVM_ELF_IMPORT_TYPES_ELFT(ELFT) GNUStyle(ScopedPrinter &W, const ELFDumper &Dumper) : DumpStyle(Dumper), @@ -967,7 +938,7 @@ template class LLVMStyle : public DumpStyle { public: - TYPEDEF_ELF_TYPES(ELFT) + LLVM_ELF_IMPORT_TYPES_ELFT(ELFT) LLVMStyle(ScopedPrinter &W, const ELFDumper &Dumper) : DumpStyle(Dumper), W(W) {} @@ -2940,12 +2911,12 @@ template class MipsGOTParser { public: - TYPEDEF_ELF_TYPES(ELFT) - using Entry = typename ELFO::Elf_Addr; + LLVM_ELF_IMPORT_TYPES_ELFT(ELFT) + using Entry = typename ELFT::Addr; using Entries = ArrayRef; const bool IsStatic; - const ELFO &Obj; + const ELFFile &Obj; const ELFDumper &Dumper; MipsGOTParser(const ELFDumper &D); diff --git a/llvm/tools/obj2yaml/elf2yaml.cpp b/llvm/tools/obj2yaml/elf2yaml.cpp --- a/llvm/tools/obj2yaml/elf2yaml.cpp +++ b/llvm/tools/obj2yaml/elf2yaml.cpp @@ -24,15 +24,7 @@ template class ELFDumper { - typedef object::Elf_Sym_Impl Elf_Sym; - typedef typename ELFT::Dyn Elf_Dyn; - typedef typename ELFT::Shdr Elf_Shdr; - typedef typename ELFT::Word Elf_Word; - typedef typename ELFT::Rel Elf_Rel; - typedef typename ELFT::Rela Elf_Rela; - using Elf_Relr = typename ELFT::Relr; - using Elf_Nhdr = typename ELFT::Nhdr; - using Elf_Note = typename ELFT::Note; + LLVM_ELF_IMPORT_TYPES_ELFT(ELFT) ArrayRef Sections; ArrayRef SymTable; @@ -1308,9 +1300,6 @@ template Expected ELFDumper::dumpVerdefSection(const Elf_Shdr *Shdr) { - typedef typename ELFT::Verdef Elf_Verdef; - typedef typename ELFT::Verdaux Elf_Verdaux; - auto S = std::make_unique(); if (Error E = dumpCommonSection(Shdr, *S)) return std::move(E); @@ -1360,8 +1349,6 @@ template Expected ELFDumper::dumpSymverSection(const Elf_Shdr *Shdr) { - typedef typename ELFT::Half Elf_Half; - auto S = std::make_unique(); if (Error E = dumpCommonSection(Shdr, *S)) return std::move(E); @@ -1380,9 +1367,6 @@ template Expected ELFDumper::dumpVerneedSection(const Elf_Shdr *Shdr) { - typedef typename ELFT::Verneed Elf_Verneed; - typedef typename ELFT::Vernaux Elf_Vernaux; - auto S = std::make_unique(); if (Error E = dumpCommonSection(Shdr, *S)) return std::move(E);