LLVM  3.7.0
Classes | Public Types | Public Member Functions | List of all members
llvm::object::ELFFile< ELFT > Class Template Reference

#include <ELF.h>

Classes

class  ArchivePointerTypeTraits
 Archive files are 2 byte aligned, so we need this for PointerIntPair to work. More...
 
class  ELFEntityIterator
 Iterate over constant sized entities. More...
 

Public Types

typedef std::conditional
< ELFT::Is64Bits, uint64_t,
uint32_t >::type 
uintX_t
 
typedef Elf_Ehdr_Impl< ELFT > Elf_Ehdr
 
typedef Elf_Shdr_Impl< ELFT > Elf_Shdr
 
typedef Elf_Sym_Impl< ELFT > Elf_Sym
 
typedef Elf_Dyn_Impl< ELFT > Elf_Dyn
 
typedef Elf_Phdr_Impl< ELFT > Elf_Phdr
 
typedef Elf_Rel_Impl< ELFT, falseElf_Rel
 
typedef Elf_Rel_Impl< ELFT, trueElf_Rela
 
typedef Elf_Verdef_Impl< ELFT > Elf_Verdef
 
typedef Elf_Verdaux_Impl< ELFT > Elf_Verdaux
 
typedef Elf_Verneed_Impl< ELFT > Elf_Verneed
 
typedef Elf_Vernaux_Impl< ELFT > Elf_Vernaux
 
typedef Elf_Versym_Impl< ELFT > Elf_Versym
 
typedef Elf_Hash_Impl< ELFT > Elf_Hash
 
typedef ELFEntityIterator
< const Elf_Dyn
Elf_Dyn_Iter
 
typedef iterator_range
< Elf_Dyn_Iter
Elf_Dyn_Range
 
typedef ELFEntityIterator
< const Elf_Rela
Elf_Rela_Iter
 
typedef ELFEntityIterator
< const Elf_Rel
Elf_Rel_Iter
 
typedef iterator_range< const
Elf_Shdr * > 
Elf_Shdr_Range
 
typedef iterator_range< const
Elf_Sym * > 
Elf_Sym_Range
 
typedef ELFEntityIterator
< const Elf_Phdr
Elf_Phdr_Iter
 Iterate over program header table. More...
 

Public Member Functions

template<typename T >
const TgetEntry (uint32_t Section, uint32_t Entry) const
 
template<typename T >
const TgetEntry (const Elf_Shdr *Section, uint32_t Entry) const
 
const Elf_ShdrgetDotSymtabSec () const
 
const Elf_ShdrgetDotDynSymSec () const
 
const Elf_HashgetHashTable () const
 
ErrorOr< StringRefgetStringTable (const Elf_Shdr *Section) const
 
const char * getDynamicString (uintX_t Offset) const
 
ErrorOr< StringRefgetSymbolVersion (const Elf_Shdr *section, const Elf_Sym *Symb, bool &IsDefault) const
 
void VerifyStrTab (const Elf_Shdr *sh) const
 
StringRef getRelocationTypeName (uint32_t Type) const
 
void getRelocationTypeName (uint32_t Type, SmallVectorImpl< char > &Result) const
 
template<class RelT >
std::pair< const Elf_Shdr
*, const Elf_Sym * > 
getRelocationSymbol (const Elf_Shdr *RelSec, const RelT *Rel) const
 Get the symbol table section and symbol for a given relocation. More...
 
 ELFFile (StringRef Object, std::error_code &EC)
 
bool isMipsELF64 () const
 
bool isMips64EL () const
 
const Elf_Shdrsection_begin () const
 
const Elf_Shdrsection_end () const
 
Elf_Shdr_Range sections () const
 
const Elf_Symsymbol_begin () const
 
const Elf_Symsymbol_end () const
 
Elf_Sym_Range symbols () const
 
Elf_Dyn_Iter dynamic_table_begin () const
 
Elf_Dyn_Iter dynamic_table_end (bool NULLEnd=false) const
 
Elf_Dyn_Range dynamic_table (bool NULLEnd=false) const
 
const Elf_Symdynamic_symbol_begin () const
 
const Elf_Symdynamic_symbol_end () const
 
Elf_Sym_Range dynamic_symbols () const
 
Elf_Rela_Iter dyn_rela_begin () const
 
Elf_Rela_Iter dyn_rela_end () const
 
Elf_Rela_Iter rela_begin (const Elf_Shdr *sec) const
 
Elf_Rela_Iter rela_end (const Elf_Shdr *sec) const
 
Elf_Rel_Iter rel_begin (const Elf_Shdr *sec) const
 
Elf_Rel_Iter rel_end (const Elf_Shdr *sec) const
 
Elf_Phdr_Iter program_header_begin () const
 
Elf_Phdr_Iter program_header_end () const
 
uint64_t getNumSections () const
 
uintX_t getStringTableIndex () const
 
ELF::Elf64_Word getExtendedSymbolTableIndex (const Elf_Sym *symb) const
 
const Elf_EhdrgetHeader () const
 
ErrorOr< const Elf_Shdr * > getSection (const Elf_Sym *symb) const
 
ErrorOr< const Elf_Shdr * > getSection (uint32_t Index) const
 
const Elf_SymgetSymbol (uint32_t index) const
 
ErrorOr< StringRefgetStaticSymbolName (const Elf_Sym *Symb) const
 
ErrorOr< StringRefgetDynamicSymbolName (const Elf_Sym *Symb) const
 
ErrorOr< StringRefgetSymbolName (const Elf_Sym *Symb, bool IsDynamic) const
 
ErrorOr< StringRefgetSectionName (const Elf_Shdr *Section) const
 
ErrorOr< ArrayRef< uint8_t > > getSectionContents (const Elf_Shdr *Sec) const
 
StringRef getLoadName () const
 
template<class RelT >
std::pair< const typename
ELFFile< ELFT >::Elf_Shdr
*, const typename ELFFile
< ELFT >::Elf_Sym * > 
getRelocationSymbol (const Elf_Shdr *Sec, const RelT *Rel) const
 

Detailed Description

template<class ELFT>
class llvm::object::ELFFile< ELFT >

Definition at line 53 of file Object/ELF.h.

Member Typedef Documentation

template<class ELFT>
typedef Elf_Dyn_Impl<ELFT> llvm::object::ELFFile< ELFT >::Elf_Dyn

Definition at line 134 of file Object/ELF.h.

template<class ELFT>
typedef ELFEntityIterator<const Elf_Dyn> llvm::object::ELFFile< ELFT >::Elf_Dyn_Iter

Definition at line 144 of file Object/ELF.h.

template<class ELFT>
typedef iterator_range<Elf_Dyn_Iter> llvm::object::ELFFile< ELFT >::Elf_Dyn_Range

Definition at line 145 of file Object/ELF.h.

template<class ELFT>
typedef Elf_Ehdr_Impl<ELFT> llvm::object::ELFFile< ELFT >::Elf_Ehdr

Definition at line 131 of file Object/ELF.h.

template<class ELFT>
typedef Elf_Hash_Impl<ELFT> llvm::object::ELFFile< ELFT >::Elf_Hash

Definition at line 143 of file Object/ELF.h.

template<class ELFT>
typedef Elf_Phdr_Impl<ELFT> llvm::object::ELFFile< ELFT >::Elf_Phdr

Definition at line 135 of file Object/ELF.h.

template<class ELFT>
typedef ELFEntityIterator<const Elf_Phdr> llvm::object::ELFFile< ELFT >::Elf_Phdr_Iter

Iterate over program header table.

Definition at line 352 of file Object/ELF.h.

template<class ELFT>
typedef Elf_Rel_Impl<ELFT, false> llvm::object::ELFFile< ELFT >::Elf_Rel

Definition at line 136 of file Object/ELF.h.

template<class ELFT>
typedef ELFEntityIterator<const Elf_Rel> llvm::object::ELFFile< ELFT >::Elf_Rel_Iter

Definition at line 147 of file Object/ELF.h.

template<class ELFT>
typedef Elf_Rel_Impl<ELFT, true> llvm::object::ELFFile< ELFT >::Elf_Rela

Definition at line 137 of file Object/ELF.h.

template<class ELFT>
typedef ELFEntityIterator<const Elf_Rela> llvm::object::ELFFile< ELFT >::Elf_Rela_Iter

Definition at line 146 of file Object/ELF.h.

template<class ELFT>
typedef Elf_Shdr_Impl<ELFT> llvm::object::ELFFile< ELFT >::Elf_Shdr

Definition at line 132 of file Object/ELF.h.

template<class ELFT>
typedef iterator_range<const Elf_Shdr *> llvm::object::ELFFile< ELFT >::Elf_Shdr_Range

Definition at line 148 of file Object/ELF.h.

template<class ELFT>
typedef Elf_Sym_Impl<ELFT> llvm::object::ELFFile< ELFT >::Elf_Sym

Definition at line 133 of file Object/ELF.h.

template<class ELFT>
typedef iterator_range<const Elf_Sym *> llvm::object::ELFFile< ELFT >::Elf_Sym_Range

Definition at line 162 of file Object/ELF.h.

template<class ELFT>
typedef Elf_Verdaux_Impl<ELFT> llvm::object::ELFFile< ELFT >::Elf_Verdaux

Definition at line 139 of file Object/ELF.h.

template<class ELFT>
typedef Elf_Verdef_Impl<ELFT> llvm::object::ELFFile< ELFT >::Elf_Verdef

Definition at line 138 of file Object/ELF.h.

template<class ELFT>
typedef Elf_Vernaux_Impl<ELFT> llvm::object::ELFFile< ELFT >::Elf_Vernaux

Definition at line 141 of file Object/ELF.h.

template<class ELFT>
typedef Elf_Verneed_Impl<ELFT> llvm::object::ELFFile< ELFT >::Elf_Verneed

Definition at line 140 of file Object/ELF.h.

template<class ELFT>
typedef Elf_Versym_Impl<ELFT> llvm::object::ELFFile< ELFT >::Elf_Versym

Definition at line 142 of file Object/ELF.h.

template<class ELFT>
typedef std::conditional<ELFT::Is64Bits, uint64_t, uint32_t>::type llvm::object::ELFFile< ELFT >::uintX_t

Definition at line 57 of file Object/ELF.h.

Constructor & Destructor Documentation

template<class ELFT >
llvm::object::ELFFile< ELFT >::ELFFile ( StringRef  Object,
std::error_code &  EC 
)

Member Function Documentation

template<class ELFT>
Elf_Rela_Iter llvm::object::ELFFile< ELFT >::dyn_rela_begin ( ) const
inline

Definition at line 315 of file Object/ELF.h.

template<class ELFT>
Elf_Rela_Iter llvm::object::ELFFile< ELFT >::dyn_rela_end ( ) const
inline

Definition at line 322 of file Object/ELF.h.

template<class ELFT>
const Elf_Sym* llvm::object::ELFFile< ELFT >::dynamic_symbol_begin ( ) const
inline

Definition at line 296 of file Object/ELF.h.

References llvm::report_fatal_error().

Referenced by llvm::object::ELFFile< ELFT >::dynamic_symbols().

template<class ELFT>
const Elf_Sym* llvm::object::ELFFile< ELFT >::dynamic_symbol_end ( ) const
inline

Definition at line 304 of file Object/ELF.h.

Referenced by llvm::object::ELFFile< ELFT >::dynamic_symbols().

template<class ELFT>
Elf_Sym_Range llvm::object::ELFFile< ELFT >::dynamic_symbols ( ) const
inline
template<class ELFT>
Elf_Dyn_Range llvm::object::ELFFile< ELFT >::dynamic_table ( bool  NULLEnd = false) const
inline
template<class ELFT >
ELFFile< ELFT >::Elf_Dyn_Iter llvm::object::ELFFile< ELFT >::dynamic_table_begin ( ) const

Definition at line 824 of file Object/ELF.h.

Referenced by llvm::object::ELFFile< ELFT >::dynamic_table().

template<class ELFT >
ELFFile< ELFT >::Elf_Dyn_Iter llvm::object::ELFFile< ELFT >::dynamic_table_end ( bool  NULLEnd = false) const
Parameters
NULLEnduse one past the first DT_NULL entry as the end instead of the section size.

Definition at line 833 of file Object/ELF.h.

References llvm::ELF::DT_NULL, and llvm::MipsISD::Ret.

Referenced by llvm::object::ELFFile< ELFT >::dynamic_table().

template<class ELFT>
const Elf_Shdr* llvm::object::ELFFile< ELFT >::getDotDynSymSec ( ) const
inline

Definition at line 244 of file Object/ELF.h.

template<class ELFT>
const Elf_Shdr* llvm::object::ELFFile< ELFT >::getDotSymtabSec ( ) const
inline

Definition at line 243 of file Object/ELF.h.

template<class ELFT >
const char * llvm::object::ELFFile< ELFT >::getDynamicString ( uintX_t  Offset) const

Definition at line 911 of file Object/ELF.h.

template<class ELFT >
ErrorOr< StringRef > llvm::object::ELFFile< ELFT >::getDynamicSymbolName ( const Elf_Sym Symb) const

Definition at line 925 of file Object/ELF.h.

template<class ELFT >
template<typename T >
const T * llvm::object::ELFFile< ELFT >::getEntry ( uint32_t  Section,
uint32_t  Entry 
) const

Definition at line 868 of file Object/ELF.h.

References llvm::ErrorOr< T >::getError(), and llvm::report_fatal_error().

template<class ELFT >
template<typename T >
const T * llvm::object::ELFFile< ELFT >::getEntry ( const Elf_Shdr Section,
uint32_t  Entry 
) const

Definition at line 877 of file Object/ELF.h.

template<class ELFT >
ELF::Elf64_Word llvm::object::ELFFile< ELFT >::getExtendedSymbolTableIndex ( const Elf_Sym symb) const

Definition at line 471 of file Object/ELF.h.

References llvm::ELF::SHN_XINDEX.

template<class ELFT>
const Elf_Hash* llvm::object::ELFFile< ELFT >::getHashTable ( ) const
inline

Definition at line 245 of file Object/ELF.h.

template<class ELFT>
const Elf_Ehdr* llvm::object::ELFFile< ELFT >::getHeader ( ) const
inline

Definition at line 369 of file Object/ELF.h.

template<class ELFT >
StringRef llvm::object::ELFFile< ELFT >::getLoadName ( ) const

Definition at line 853 of file Object/ELF.h.

References llvm::ELF::DT_SONAME.

template<class ELFT >
uint64_t llvm::object::ELFFile< ELFT >::getNumSections ( ) const

Definition at line 554 of file Object/ELF.h.

References llvm::ELF::SHN_UNDEF.

Referenced by llvm::object::ELFFile< ELFT >::ELFFile().

template<class ELFT>
template<class RelT >
std::pair<const Elf_Shdr *, const Elf_Sym *> llvm::object::ELFFile< ELFT >::getRelocationSymbol ( const Elf_Shdr RelSec,
const RelT *  Rel 
) const

Get the symbol table section and symbol for a given relocation.

template<class ELFT>
template<class RelT >
std::pair<const typename ELFFile<ELFT>::Elf_Shdr *, const typename ELFFile<ELFT>::Elf_Sym *> llvm::object::ELFFile< ELFT >::getRelocationSymbol ( const Elf_Shdr Sec,
const RelT *  Rel 
) const

Definition at line 542 of file Object/ELF.h.

References llvm::ErrorOr< T >::getError(), and llvm::report_fatal_error().

template<class ELFT >
StringRef llvm::object::ELFFile< ELFT >::getRelocationTypeName ( uint32_t  Type) const

Definition at line 503 of file Object/ELF.h.

References llvm::object::getELFRelocationTypeName().

template<class ELFT >
void llvm::object::ELFFile< ELFT >::getRelocationTypeName ( uint32_t  Type,
SmallVectorImpl< char > &  Result 
) const
template<class ELFT >
ErrorOr< const typename ELFFile< ELFT >::Elf_Shdr * > llvm::object::ELFFile< ELFT >::getSection ( const Elf_Sym symb) const
template<class ELFT >
ErrorOr< const typename ELFFile< ELFT >::Elf_Shdr * > llvm::object::ELFFile< ELFT >::getSection ( uint32_t  Index) const

Definition at line 885 of file Object/ELF.h.

References llvm::object::invalid_section_index.

template<class ELFT >
ErrorOr< ArrayRef< uint8_t > > llvm::object::ELFFile< ELFT >::getSectionContents ( const Elf_Shdr Sec) const

Definition at line 495 of file Object/ELF.h.

References llvm::makeArrayRef(), and llvm::object::parse_failed.

template<class ELFT >
ErrorOr< StringRef > llvm::object::ELFFile< ELFT >::getSectionName ( const Elf_Shdr Section) const

Definition at line 939 of file Object/ELF.h.

References llvm::object::parse_failed.

template<class ELFT >
ErrorOr< StringRef > llvm::object::ELFFile< ELFT >::getStaticSymbolName ( const Elf_Sym Symb) const

Definition at line 919 of file Object/ELF.h.

References llvm::object::Elf_Sym_Impl< ELFT >::getName().

template<class ELFT >
ErrorOr< StringRef > llvm::object::ELFFile< ELFT >::getStringTable ( const Elf_Shdr Section) const
template<class ELFT >
ELFFile< ELFT >::uintX_t llvm::object::ELFFile< ELFT >::getStringTableIndex ( ) const

Definition at line 564 of file Object/ELF.h.

References llvm::ELF::SHN_HIRESERVE, and llvm::ELF::SHN_UNDEF.

Referenced by llvm::object::ELFFile< ELFT >::ELFFile().

template<class ELFT >
const ELFFile< ELFT >::Elf_Sym * llvm::object::ELFFile< ELFT >::getSymbol ( uint32_t  index) const

Definition at line 489 of file Object/ELF.h.

template<class ELFT >
ErrorOr< StringRef > llvm::object::ELFFile< ELFT >::getSymbolName ( const Elf_Sym Symb,
bool  IsDynamic 
) const

Definition at line 930 of file Object/ELF.h.

template<class ELFT >
ErrorOr< StringRef > llvm::object::ELFFile< ELFT >::getSymbolVersion ( const Elf_Shdr section,
const Elf_Sym Symb,
bool IsDefault 
) const
template<class ELFT>
bool llvm::object::ELFFile< ELFT >::isMips64EL ( ) const
inline
template<class ELFT>
bool llvm::object::ELFFile< ELFT >::isMipsELF64 ( ) const
inline
template<class ELFT>
Elf_Phdr_Iter llvm::object::ELFFile< ELFT >::program_header_begin ( ) const
inline
template<class ELFT>
Elf_Phdr_Iter llvm::object::ELFFile< ELFT >::program_header_end ( ) const
inline
template<class ELFT>
Elf_Rel_Iter llvm::object::ELFFile< ELFT >::rel_begin ( const Elf_Shdr sec) const
inline

Definition at line 341 of file Object/ELF.h.

template<class ELFT>
Elf_Rel_Iter llvm::object::ELFFile< ELFT >::rel_end ( const Elf_Shdr sec) const
inline

Definition at line 346 of file Object/ELF.h.

template<class ELFT>
Elf_Rela_Iter llvm::object::ELFFile< ELFT >::rela_begin ( const Elf_Shdr sec) const
inline

Definition at line 330 of file Object/ELF.h.

template<class ELFT>
Elf_Rela_Iter llvm::object::ELFFile< ELFT >::rela_end ( const Elf_Shdr sec) const
inline

Definition at line 335 of file Object/ELF.h.

template<class ELFT >
const ELFFile< ELFT >::Elf_Shdr * llvm::object::ELFFile< ELFT >::section_begin ( ) const

Definition at line 793 of file Object/ELF.h.

References llvm::report_fatal_error().

Referenced by llvm::object::ELFFile< ELFT >::sections().

template<class ELFT >
const ELFFile< ELFT >::Elf_Shdr * llvm::object::ELFFile< ELFT >::section_end ( ) const

Definition at line 801 of file Object/ELF.h.

Referenced by llvm::object::ELFFile< ELFT >::sections().

template<class ELFT>
Elf_Shdr_Range llvm::object::ELFFile< ELFT >::sections ( ) const
inline
template<class ELFT >
const ELFFile< ELFT >::Elf_Sym * llvm::object::ELFFile< ELFT >::symbol_begin ( ) const

Definition at line 806 of file Object/ELF.h.

References llvm::report_fatal_error().

Referenced by llvm::object::ELFFile< ELFT >::symbols().

template<class ELFT >
const ELFFile< ELFT >::Elf_Sym * llvm::object::ELFFile< ELFT >::symbol_end ( ) const

Definition at line 815 of file Object/ELF.h.

Referenced by llvm::object::ELFFile< ELFT >::symbols().

template<class ELFT>
Elf_Sym_Range llvm::object::ELFFile< ELFT >::symbols ( ) const
inline
template<class ELFT>
void llvm::object::ELFFile< ELFT >::VerifyStrTab ( const Elf_Shdr sh) const

The documentation for this class was generated from the following file: