Index: include/llvm/Object/ELFTypes.h =================================================================== --- include/llvm/Object/ELFTypes.h +++ include/llvm/Object/ELFTypes.h @@ -21,9 +21,55 @@ using support::endianness; -template struct ELFType { - static const endianness TargetEndianness = target_endianness; - static const bool Is64Bits = is64Bits; +template struct Elf_Ehdr_Impl; +template struct Elf_Shdr_Impl; +template struct Elf_Sym_Impl; +template struct Elf_Dyn_Impl; +template struct Elf_Phdr_Impl; +template struct Elf_Rel_Impl; +template struct Elf_Verdef_Impl; +template struct Elf_Verdaux_Impl; +template struct Elf_Verneed_Impl; +template struct Elf_Vernaux_Impl; +template struct Elf_Versym_Impl; +template struct Elf_Hash_Impl; +template struct Elf_GnuHash_Impl; + +template struct ELFType { +private: + template + using packed = support::detail::packed_endian_specific_integral; + +public: + static const endianness TargetEndianness = E; + static const bool Is64Bits = Is64; + + typedef typename std::conditional::type uint; + typedef Elf_Ehdr_Impl> Ehdr; + typedef Elf_Shdr_Impl> Shdr; + typedef Elf_Sym_Impl> Sym; + typedef Elf_Dyn_Impl> Dyn; + typedef Elf_Phdr_Impl> Phdr; + typedef Elf_Rel_Impl, false> Rel; + typedef Elf_Rel_Impl, true> Rela; + typedef Elf_Verdef_Impl> Verdef; + typedef Elf_Verdaux_Impl> Verdaux; + typedef Elf_Verneed_Impl> Verneed; + typedef Elf_Vernaux_Impl> Vernaux; + typedef Elf_Versym_Impl> Versym; + typedef Elf_Hash_Impl> Hash; + typedef Elf_GnuHash_Impl> GnuHash; + typedef iterator_range DynRange; + typedef iterator_range ShdrRange; + typedef iterator_range SymRange; + + typedef packed Half; + typedef packed Word; + typedef packed Sword; + typedef packed Xword; + typedef packed Sxword; + typedef packed Addr; + typedef packed Off; }; typedef ELFType ELF32LE; @@ -320,9 +366,6 @@ uintX_t getPtr() const { return d_un.d_ptr; } }; -// Elf_Rel: Elf Relocation -template struct Elf_Rel_Impl; - template struct Elf_Rel_Impl, false> { LLVM_ELF_IMPORT_TYPES(TargetEndianness, false)