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

#include "llvm/Object/ELF.h"

Public Types

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
 

Public Member Functions

const uint8_t * base () const
 
size_t getBufSize () const
 
const Elf_EhdrgetHeader () const
 
template<typename T >
Expected< const T * > getEntry (uint32_t Section, uint32_t Entry) const
 
template<typename T >
Expected< const T * > getEntry (const Elf_Shdr *Section, uint32_t Entry) const
 
Expected< StringRefgetStringTable (const Elf_Shdr *Section) const
 
Expected< StringRefgetStringTableForSymtab (const Elf_Shdr &Section) const
 
Expected< StringRefgetStringTableForSymtab (const Elf_Shdr &Section, Elf_Shdr_Range Sections) const
 
Expected< ArrayRef< Elf_Word > > getSHNDXTable (const Elf_Shdr &Section) const
 
Expected< ArrayRef< Elf_Word > > getSHNDXTable (const Elf_Shdr &Section, Elf_Shdr_Range Sections) const
 
StringRef getRelocationTypeName (uint32_t Type) const
 
void getRelocationTypeName (uint32_t Type, SmallVectorImpl< char > &Result) const
 
uint32_t getRelativeRelocationType () const
 
const chargetDynamicTagAsString (unsigned Arch, uint64_t Type) const
 
const chargetDynamicTagAsString (uint64_t Type) const
 
Expected< const Elf_Sym * > getRelocationSymbol (const Elf_Rel *Rel, const Elf_Shdr *SymTab) const
 Get the symbol for a given relocation. More...
 
bool isMipsELF64 () const
 
bool isMips64EL () const
 
Expected< Elf_Shdr_Rangesections () const
 
Expected< Elf_Dyn_RangedynamicEntries () const
 
Expected< const uint8_t * > toMappedAddr (uint64_t VAddr) const
 
Expected< Elf_Sym_Rangesymbols (const Elf_Shdr *Sec) const
 
Expected< Elf_Rela_Rangerelas (const Elf_Shdr *Sec) const
 
Expected< Elf_Rel_Rangerels (const Elf_Shdr *Sec) const
 
Expected< Elf_Relr_Rangerelrs (const Elf_Shdr *Sec) const
 
Expected< std::vector< Elf_Rela > > decode_relrs (Elf_Relr_Range relrs) const
 
Expected< std::vector< Elf_Rela > > android_relas (const Elf_Shdr *Sec) const
 
Expected< Elf_Phdr_Rangeprogram_headers () const
 Iterate over program header table. More...
 
Elf_Note_Iterator notes_begin (const Elf_Phdr &Phdr, Error &Err) const
 Get an iterator over notes in a program header. More...
 
Elf_Note_Iterator notes_begin (const Elf_Shdr &Shdr, Error &Err) const
 Get an iterator over notes in a section. More...
 
Elf_Note_Iterator notes_end () const
 Get the end iterator for notes. More...
 
iterator_range< Elf_Note_Iteratornotes (const Elf_Phdr &Phdr, Error &Err) const
 Get an iterator range over notes of a program header. More...
 
iterator_range< Elf_Note_Iteratornotes (const Elf_Shdr &Shdr, Error &Err) const
 Get an iterator range over notes of a section. More...
 
Expected< StringRefgetSectionStringTable (Elf_Shdr_Range Sections) const
 
Expected< uint32_tgetSectionIndex (const Elf_Sym *Sym, Elf_Sym_Range Syms, ArrayRef< Elf_Word > ShndxTable) const
 
Expected< const Elf_Shdr * > getSection (const Elf_Sym *Sym, const Elf_Shdr *SymTab, ArrayRef< Elf_Word > ShndxTable) const
 
Expected< const Elf_Shdr * > getSection (const Elf_Sym *Sym, Elf_Sym_Range Symtab, ArrayRef< Elf_Word > ShndxTable) const
 
Expected< const Elf_Shdr * > getSection (uint32_t Index) const
 
Expected< const Elf_Shdr * > getSection (const StringRef SectionName) const
 
Expected< const Elf_Sym * > getSymbol (const Elf_Shdr *Sec, uint32_t Index) const
 
Expected< StringRefgetSectionName (const Elf_Shdr *Section) const
 
Expected< StringRefgetSectionName (const Elf_Shdr *Section, StringRef DotShstrtab) const
 
template<typename T >
Expected< ArrayRef< T > > getSectionContentsAsArray (const Elf_Shdr *Sec) const
 
Expected< ArrayRef< uint8_t > > getSectionContents (const Elf_Shdr *Sec) const
 

Static Public Member Functions

static Expected< ELFFilecreate (StringRef Object)
 

Detailed Description

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

Definition at line 53 of file ELF.h.

Member Typedef Documentation

◆ Elf_Dyn

template<class ELFT>
using llvm::object::ELFFile< ELFT >::Elf_Dyn = typename ELFT::Dyn

Definition at line 60 of file ELF.h.

◆ Elf_Dyn_Range

template<class ELFT>
using llvm::object::ELFFile< ELFT >::Elf_Dyn_Range = typename ELFT::DynRange

Definition at line 75 of file ELF.h.

◆ Elf_Ehdr

template<class ELFT>
using llvm::object::ELFFile< ELFT >::Elf_Ehdr = typename ELFT::Ehdr

Definition at line 57 of file ELF.h.

◆ Elf_GnuHash

template<class ELFT>
using llvm::object::ELFFile< ELFT >::Elf_GnuHash = typename ELFT::GnuHash

Definition at line 71 of file ELF.h.

◆ Elf_Hash

template<class ELFT>
using llvm::object::ELFFile< ELFT >::Elf_Hash = typename ELFT::Hash

Definition at line 70 of file ELF.h.

◆ Elf_Nhdr

template<class ELFT>
using llvm::object::ELFFile< ELFT >::Elf_Nhdr = typename ELFT::Nhdr

Definition at line 72 of file ELF.h.

◆ Elf_Note

template<class ELFT>
using llvm::object::ELFFile< ELFT >::Elf_Note = typename ELFT::Note

Definition at line 73 of file ELF.h.

◆ Elf_Note_Iterator

template<class ELFT>
using llvm::object::ELFFile< ELFT >::Elf_Note_Iterator = typename ELFT::NoteIterator

Definition at line 74 of file ELF.h.

◆ Elf_Phdr

template<class ELFT>
using llvm::object::ELFFile< ELFT >::Elf_Phdr = typename ELFT::Phdr

Definition at line 61 of file ELF.h.

◆ Elf_Phdr_Range

template<class ELFT>
using llvm::object::ELFFile< ELFT >::Elf_Phdr_Range = typename ELFT::PhdrRange

Definition at line 81 of file ELF.h.

◆ Elf_Rel

template<class ELFT>
using llvm::object::ELFFile< ELFT >::Elf_Rel = typename ELFT::Rel

Definition at line 62 of file ELF.h.

◆ Elf_Rel_Range

template<class ELFT>
using llvm::object::ELFFile< ELFT >::Elf_Rel_Range = typename ELFT::RelRange

Definition at line 78 of file ELF.h.

◆ Elf_Rela

template<class ELFT>
using llvm::object::ELFFile< ELFT >::Elf_Rela = typename ELFT::Rela

Definition at line 63 of file ELF.h.

◆ Elf_Rela_Range

template<class ELFT>
using llvm::object::ELFFile< ELFT >::Elf_Rela_Range = typename ELFT::RelaRange

Definition at line 79 of file ELF.h.

◆ Elf_Relr

template<class ELFT>
using llvm::object::ELFFile< ELFT >::Elf_Relr = typename ELFT::Relr

Definition at line 64 of file ELF.h.

◆ Elf_Relr_Range

template<class ELFT>
using llvm::object::ELFFile< ELFT >::Elf_Relr_Range = typename ELFT::RelrRange

Definition at line 80 of file ELF.h.

◆ Elf_Shdr

template<class ELFT>
using llvm::object::ELFFile< ELFT >::Elf_Shdr = typename ELFT::Shdr

Definition at line 58 of file ELF.h.

◆ Elf_Shdr_Range

template<class ELFT>
using llvm::object::ELFFile< ELFT >::Elf_Shdr_Range = typename ELFT::ShdrRange

Definition at line 76 of file ELF.h.

◆ Elf_Sym

template<class ELFT>
using llvm::object::ELFFile< ELFT >::Elf_Sym = typename ELFT::Sym

Definition at line 59 of file ELF.h.

◆ Elf_Sym_Range

template<class ELFT>
using llvm::object::ELFFile< ELFT >::Elf_Sym_Range = typename ELFT::SymRange

Definition at line 77 of file ELF.h.

◆ Elf_Verdaux

template<class ELFT>
using llvm::object::ELFFile< ELFT >::Elf_Verdaux = typename ELFT::Verdaux

Definition at line 66 of file ELF.h.

◆ Elf_Verdef

template<class ELFT>
using llvm::object::ELFFile< ELFT >::Elf_Verdef = typename ELFT::Verdef

Definition at line 65 of file ELF.h.

◆ Elf_Vernaux

template<class ELFT>
using llvm::object::ELFFile< ELFT >::Elf_Vernaux = typename ELFT::Vernaux

Definition at line 68 of file ELF.h.

◆ Elf_Verneed

template<class ELFT>
using llvm::object::ELFFile< ELFT >::Elf_Verneed = typename ELFT::Verneed

Definition at line 67 of file ELF.h.

◆ Elf_Versym

template<class ELFT>
using llvm::object::ELFFile< ELFT >::Elf_Versym = typename ELFT::Versym

Definition at line 69 of file ELF.h.

◆ uintX_t

template<class ELFT>
using llvm::object::ELFFile< ELFT >::uintX_t = typename ELFT::uint

Definition at line 56 of file ELF.h.

Member Function Documentation

◆ android_relas()

template<class ELFT>
Expected< std::vector< typename ELFT::Rela > > ELFFile::android_relas ( const Elf_Shdr Sec) const

Definition at line 348 of file ELF.cpp.

References llvm::Expected< T >::takeError().

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

◆ base()

template<class ELFT>
const uint8_t* llvm::object::ELFFile< ELFT >::base ( ) const
inline

◆ create()

template<class ELFT >
Expected< ELFFile< ELFT > > llvm::object::ELFFile< ELFT >::create ( StringRef  Object)
static

◆ decode_relrs()

template<class ELFT>
Expected< std::vector< typename ELFT::Rela > > ELFFile::decode_relrs ( Elf_Relr_Range  relrs) const

Definition at line 269 of file ELF.cpp.

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

◆ dynamicEntries()

template<class ELFT>
Expected< typename ELFT::DynRange > ELFFile::dynamicEntries ( ) const

◆ getBufSize()

template<class ELFT>
size_t llvm::object::ELFFile< ELFT >::getBufSize ( ) const
inline

Definition at line 87 of file ELF.h.

References llvm::StringRef::size().

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

◆ getDynamicTagAsString() [1/2]

template<class ELFT>
const char * ELFFile::getDynamicTagAsString ( unsigned  Arch,
uint64_t  Type 
) const

◆ getDynamicTagAsString() [2/2]

template<class ELFT>
const char * ELFFile::getDynamicTagAsString ( uint64_t  Type) const

Definition at line 479 of file ELF.cpp.

◆ getEntry() [1/2]

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

◆ getEntry() [2/2]

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

◆ getHeader()

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

◆ getRelativeRelocationType()

template<class ELFT >
uint32_t llvm::object::ELFFile< ELFT >::getRelativeRelocationType ( ) const

◆ getRelocationSymbol()

template<class ELFT >
Expected< const typename ELFT::Sym * > llvm::object::ELFFile< ELFT >::getRelocationSymbol ( const Elf_Rel Rel,
const Elf_Shdr SymTab 
) const

Get the symbol for a given relocation.

Definition at line 424 of file ELF.h.

References llvm::object::ELFFile< ELFT >::isMips64EL().

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

◆ getRelocationTypeName() [1/2]

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

◆ getRelocationTypeName() [2/2]

template<class ELFT >
void llvm::object::ELFFile< ELFT >::getRelocationTypeName ( uint32_t  Type,
SmallVectorImpl< char > &  Result 
) const

◆ getSection() [1/4]

template<class ELFT >
Expected< const typename ELFT::Shdr * > llvm::object::ELFFile< ELFT >::getSection ( const Elf_Sym Sym,
const Elf_Shdr SymTab,
ArrayRef< Elf_Word >  ShndxTable 
) const

◆ getSection() [2/4]

template<class ELFT >
Expected< const typename ELFT::Shdr * > llvm::object::ELFFile< ELFT >::getSection ( const Elf_Sym Sym,
Elf_Sym_Range  Symtab,
ArrayRef< Elf_Word >  ShndxTable 
) const

◆ getSection() [3/4]

template<class ELFT >
Expected< const typename ELFT::Shdr * > llvm::object::ELFFile< ELFT >::getSection ( uint32_t  Index) const

Definition at line 517 of file ELF.h.

References llvm::object::ELFFile< ELFT >::sections().

◆ getSection() [4/4]

template<class ELFT >
Expected< const typename ELFT::Shdr * > llvm::object::ELFFile< ELFT >::getSection ( const StringRef  SectionName) const

◆ getSectionContents()

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

Definition at line 377 of file ELF.h.

◆ getSectionContentsAsArray()

template<class ELFT >
template<typename T >
Expected< ArrayRef< T > > llvm::object::ELFFile< ELFT >::getSectionContentsAsArray ( const Elf_Shdr Sec) const

Definition at line 355 of file ELF.h.

References llvm::object::createError(), llvm::max(), Size, and llvm::StringRef::size().

◆ getSectionIndex()

template<class ELFT >
Expected< uint32_t > llvm::object::ELFFile< ELFT >::getSectionIndex ( const Elf_Sym Sym,
Elf_Sym_Range  Syms,
ArrayRef< Elf_Word >  ShndxTable 
) const

◆ getSectionName() [1/2]

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

◆ getSectionName() [2/2]

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

◆ getSectionStringTable()

template<class ELFT >
Expected< StringRef > llvm::object::ELFFile< ELFT >::getSectionStringTable ( Elf_Shdr_Range  Sections) const

◆ getSHNDXTable() [1/2]

template<class ELFT >
Expected< ArrayRef< typename ELFT::Word > > llvm::object::ELFFile< ELFT >::getSHNDXTable ( const Elf_Shdr Section) const

◆ getSHNDXTable() [2/2]

template<class ELFT >
Expected< ArrayRef< typename ELFT::Word > > llvm::object::ELFFile< ELFT >::getSHNDXTable ( const Elf_Shdr Section,
Elf_Shdr_Range  Sections 
) const

◆ getStringTable()

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

◆ getStringTableForSymtab() [1/2]

template<class ELFT >
Expected< StringRef > llvm::object::ELFFile< ELFT >::getStringTableForSymtab ( const Elf_Shdr Section) const

◆ getStringTableForSymtab() [2/2]

template<class ELFT >
Expected< StringRef > llvm::object::ELFFile< ELFT >::getStringTableForSymtab ( const Elf_Shdr Section,
Elf_Shdr_Range  Sections 
) const

◆ getSymbol()

template<class ELFT >
Expected< const typename ELFT::Sym * > llvm::object::ELFFile< ELFT >::getSymbol ( const Elf_Shdr Sec,
uint32_t  Index 
) const

Definition at line 345 of file ELF.h.

References llvm::object::ELFFile< ELFT >::symbols().

◆ isMips64EL()

template<class ELFT>
bool llvm::object::ELFFile< ELFT >::isMips64EL ( ) const
inline

◆ isMipsELF64()

template<class ELFT>
bool llvm::object::ELFFile< ELFT >::isMipsELF64 ( ) const
inline

◆ notes() [1/2]

template<class ELFT>
iterator_range<Elf_Note_Iterator> llvm::object::ELFFile< ELFT >::notes ( const Elf_Phdr Phdr,
Error Err 
) const
inline

Get an iterator range over notes of a program header.

The program header must be of type PT_NOTE.

Parameters
Phdrthe program header to iterate over.
Err[out] an error to support fallible iteration, which should be checked after iteration ends.

Definition at line 228 of file ELF.h.

◆ notes() [2/2]

template<class ELFT>
iterator_range<Elf_Note_Iterator> llvm::object::ELFFile< ELFT >::notes ( const Elf_Shdr Shdr,
Error Err 
) const
inline

Get an iterator range over notes of a section.

The section must be of type SHT_NOTE.

Parameters
Shdrthe section to iterate over.
Err[out] an error to support fallible iteration, which should be checked after iteration ends.

Definition at line 240 of file ELF.h.

◆ notes_begin() [1/2]

template<class ELFT>
Elf_Note_Iterator llvm::object::ELFFile< ELFT >::notes_begin ( const Elf_Phdr Phdr,
Error Err 
) const
inline

Get an iterator over notes in a program header.

The program header must be of type PT_NOTE.

Parameters
Phdrthe program header to iterate over.
Err[out] an error to support fallible iteration, which should be checked after iteration ends.

Definition at line 185 of file ELF.h.

◆ notes_begin() [2/2]

template<class ELFT>
Elf_Note_Iterator llvm::object::ELFFile< ELFT >::notes_begin ( const Elf_Shdr Shdr,
Error Err 
) const
inline

Get an iterator over notes in a section.

The section must be of type SHT_NOTE.

Parameters
Shdrthe section to iterate over.
Err[out] an error to support fallible iteration, which should be checked after iteration ends.

Definition at line 204 of file ELF.h.

◆ notes_end()

template<class ELFT>
Elf_Note_Iterator llvm::object::ELFFile< ELFT >::notes_end ( ) const
inline

Get the end iterator for notes.

Definition at line 217 of file ELF.h.

◆ program_headers()

template<class ELFT>
Expected<Elf_Phdr_Range> llvm::object::ELFFile< ELFT >::program_headers ( ) const
inline

◆ relas()

template<class ELFT>
Expected<Elf_Rela_Range> llvm::object::ELFFile< ELFT >::relas ( const Elf_Shdr Sec) const
inline

Definition at line 149 of file ELF.h.

◆ relrs()

template<class ELFT>
Expected<Elf_Relr_Range> llvm::object::ELFFile< ELFT >::relrs ( const Elf_Shdr Sec) const
inline

◆ rels()

template<class ELFT>
Expected<Elf_Rel_Range> llvm::object::ELFFile< ELFT >::rels ( const Elf_Shdr Sec) const
inline

Definition at line 153 of file ELF.h.

◆ sections()

template<class ELFT >
Expected< typename ELFT::ShdrRange > llvm::object::ELFFile< ELFT >::sections ( ) const

◆ symbols()

template<class ELFT>
Expected<Elf_Sym_Range> llvm::object::ELFFile< ELFT >::symbols ( const Elf_Shdr Sec) const
inline

◆ toMappedAddr()

template<class ELFT>
Expected< const uint8_t * > ELFFile::toMappedAddr ( uint64_t  VAddr) const

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