LLVM API Documentation

Classes | Public Types | Public Member Functions
llvm::object::ELFFile< ELFT > Class Template Reference

#include <ELF.h>

List of all members.

Classes

class  ArchivePointerTypeTraits
 Archive files are 2 byte aligned, so we need this for PointerIntPair to work. More...
struct  DynRegionInfo
 Represents a region described by entries in the .dynamic table.
class  Elf_Sym_Iter
class  ELFEntityIterator
 Iterate over constant sized entities. More...
class  VersionMapEntry

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 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 ELFEntityIterator
< const Elf_Shdr
Elf_Shdr_Iter
typedef iterator_range
< Elf_Shdr_Iter
Elf_Shdr_Range
typedef ELFEntityIterator
< const Elf_Phdr
Elf_Phdr_Iter
 Iterate over program header table.

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 char * getString (uint32_t section, uint32_t offset) const
const char * getString (const Elf_Shdr *section, uint32_t offset) 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.
 ELFFile (StringRef Object, std::error_code &ec)
bool isMipsELF64 () const
bool isMips64EL () const
Elf_Shdr_Iter begin_sections () const
Elf_Shdr_Iter end_sections () const
Elf_Shdr_Range sections () const
Elf_Sym_Iter begin_symbols () const
Elf_Sym_Iter end_symbols () const
Elf_Dyn_Iter begin_dynamic_table () const
Elf_Dyn_Iter end_dynamic_table (bool NULLEnd=false) const
Elf_Dyn_Range dynamic_table (bool NULLEnd=false) const
Elf_Sym_Iter begin_dynamic_symbols () const
Elf_Sym_Iter end_dynamic_symbols () const
Elf_Rela_Iter begin_rela (const Elf_Shdr *sec) const
Elf_Rela_Iter end_rela (const Elf_Shdr *sec) const
Elf_Rel_Iter begin_rel (const Elf_Shdr *sec) const
Elf_Rel_Iter end_rel (const Elf_Shdr *sec) const
Elf_Phdr_Iter begin_program_headers () const
Elf_Phdr_Iter end_program_headers () const
uint64_t getNumSections () const
uintX_t getStringTableIndex () const
ELF::Elf64_Word getSymbolTableIndex (const Elf_Sym *symb) const
const Elf_EhdrgetHeader () const
const Elf_ShdrgetSection (const Elf_Sym *symb) const
const Elf_ShdrgetSection (uint32_t Index) const
const Elf_SymgetSymbol (uint32_t index) const
ErrorOr< StringRefgetSymbolName (Elf_Sym_Iter Sym) const
ErrorOr< StringRefgetSymbolName (const Elf_Shdr *SymTab, const Elf_Sym *Symb) const
 Get the name of Symb.
ErrorOr< StringRefgetSectionName (const Elf_Shdr *Section) const
uint64_t getSymbolIndex (const Elf_Sym *sym) const
ErrorOr< ArrayRef< uint8_t > > getSectionContents (const Elf_Shdr *Sec) const
StringRef getLoadName () const

Detailed Description

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

Definition at line 52 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 127 of file Object/ELF.h.

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

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

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

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

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

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

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

Definition at line 128 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 388 of file Object/ELF.h.

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

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

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

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

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

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

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

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

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

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

template<class ELFT>
typedef ELFEntityIterator<const Elf_Shdr> llvm::object::ELFFile< ELFT >::Elf_Shdr_Iter

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

template<class ELFT>
typedef iterator_range<Elf_Shdr_Iter> llvm::object::ELFFile< ELFT >::Elf_Shdr_Range

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

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

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

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

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

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

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

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

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

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

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

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

Definition at line 135 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 56 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_Sym_Iter llvm::object::ELFFile< ELFT >::begin_dynamic_symbols ( ) const [inline]

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

template<class ELFT >
ELFFile< ELFT >::Elf_Dyn_Iter llvm::object::ELFFile< ELFT >::begin_dynamic_table ( ) const

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

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

template<class ELFT>
Elf_Phdr_Iter llvm::object::ELFFile< ELFT >::begin_program_headers ( ) const [inline]
template<class ELFT>
Elf_Rel_Iter llvm::object::ELFFile< ELFT >::begin_rel ( const Elf_Shdr sec) const [inline]

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

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

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

template<class ELFT >
ELFFile< ELFT >::Elf_Shdr_Iter llvm::object::ELFFile< ELFT >::begin_sections ( ) const

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

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

template<class ELFT >
ELFFile< ELFT >::Elf_Sym_Iter llvm::object::ELFFile< ELFT >::begin_symbols ( ) const

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

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

template<class ELFT>
Elf_Dyn_Range llvm::object::ELFFile< ELFT >::dynamic_table ( bool  NULLEnd = false) const [inline]
template<class ELFT>
Elf_Sym_Iter llvm::object::ELFFile< ELFT >::end_dynamic_symbols ( ) const [inline]

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

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

Definition at line 804 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>
Elf_Phdr_Iter llvm::object::ELFFile< ELFT >::end_program_headers ( ) const [inline]
template<class ELFT>
Elf_Rel_Iter llvm::object::ELFFile< ELFT >::end_rel ( const Elf_Shdr sec) const [inline]

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

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

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

template<class ELFT >
ELFFile< ELFT >::Elf_Shdr_Iter llvm::object::ELFFile< ELFT >::end_sections ( ) const

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

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

template<class ELFT >
ELFFile< ELFT >::Elf_Sym_Iter llvm::object::ELFFile< ELFT >::end_symbols ( ) const

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

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

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

Definition at line 882 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 839 of file Object/ELF.h.

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

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

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

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

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

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

References llvm::ELF::DT_SONAME.

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

Definition at line 604 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 typename ELFFile< ELFT >::Elf_Shdr *, const typename ELFFile< ELFT >::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.

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

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

Definition at line 547 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 >
const ELFFile< ELFT >::Elf_Shdr * llvm::object::ELFFile< ELFT >::getSection ( const Elf_Sym symb) const
template<class ELFT >
const ELFFile< ELFT >::Elf_Shdr * llvm::object::ELFFile< ELFT >::getSection ( uint32_t  Index) const

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

References llvm::report_fatal_error().

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

Definition at line 539 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 915 of file Object/ELF.h.

References llvm::object::parse_failed.

template<class ELFT >
const char * llvm::object::ELFFile< ELFT >::getString ( uint32_t  section,
uint32_t  offset 
) const

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

template<class ELFT >
const char * llvm::object::ELFFile< ELFT >::getString ( const Elf_Shdr section,
uint32_t  offset 
) const

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

References llvm::report_fatal_error(), and llvm::ELF::SHT_STRTAB.

template<class ELFT >
ELFFile< ELFT >::uintX_t llvm::object::ELFFile< ELFT >::getStringTableIndex ( ) const

Definition at line 614 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 533 of file Object/ELF.h.

template<class ELFT >
uint64_t llvm::object::ELFFile< ELFT >::getSymbolIndex ( const Elf_Sym sym) const

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

template<class ELFT >
ErrorOr< StringRef > llvm::object::ELFFile< ELFT >::getSymbolName ( Elf_Sym_Iter  Sym) const
template<class ELFT >
ErrorOr< StringRef > llvm::object::ELFFile< ELFT >::getSymbolName ( const Elf_Shdr SymTab,
const Elf_Sym Symb 
) const

Get the name of Symb.

Parameters:
SymTabThe symbol table section Symb is contained in.
SymbThe symbol to get the name of.

SymTab is used to lookup the string table to use to get the symbol's name.

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

References llvm::object::parse_failed.

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

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

References llvm::ELF::SHN_XINDEX.

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_Shdr_Range llvm::object::ELFFile< ELFT >::sections ( ) const [inline]
template<class ELFT >
void llvm::object::ELFFile< ELFT >::VerifyStrTab ( const Elf_Shdr sh) const

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

References llvm::report_fatal_error().

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


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