LLVM: llvm::objcopy:🧝:ELFFile< ELFT > Class Template Reference (original) (raw)

#include "[llvm/Object/ELF.h](Object%5F2ELF%5F8h%5Fsource.html)"

Public Member Functions
ELFFile (const ELFFile &)=default
ELFFile (ELFFile &&)=default
ELFFile & operator= (const ELFFile &)=default
const uint8_t * base () const
const uint8_t * end () const
size_t getBufSize () const
Expected< uint32_t > getPhNum () const
Expected< uint64_t > getShNum () const
Expected< uint32_t > getShStrNdx () const
const Elf_Ehdr & getHeader () 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< std::vector< VerDef > > getVersionDefinitions (const Elf_Shdr &Sec) const
Expected< std::vector< VerNeed > > getVersionDependencies (const Elf_Shdr &Sec, WarningHandler WarnHandler=&defaultWarningHandler) const
Expected< StringRef > getSymbolVersionByIndex (uint32_t SymbolVersionIndex, bool &IsDefault, SmallVector< std::optional< VersionEntry >, 0 > &VersionMap, std::optional< bool > IsSymHidden) const
Expected< StringRef > getStringTable (const Elf_Shdr &Section, WarningHandler WarnHandler=&defaultWarningHandler) const
Expected< StringRef > getStringTableForSymtab (const Elf_Shdr &Section) const
Expected< StringRef > getStringTableForSymtab (const Elf_Shdr &Section, Elf_Shdr_Range Sections) const
Expected< StringRef > getLinkAsStrtab (const typename ELFT::Shdr &Sec) 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
Expected< uint64_t > getDynSymtabSize () const
This function determines the number of dynamic symbols.
StringRef getRelocationTypeName (uint32_t Type) const
void getRelocationTypeName (uint32_t Type, SmallVectorImpl< char > &Result) const
uint32_t getRelativeRelocationType () const
std::string getDynamicTagAsString (unsigned Arch, uint64_t Type) const
std::string getDynamicTagAsString (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.
Expected< SmallVector< std::optional< VersionEntry >, 0 > > loadVersionMap (const Elf_Shdr *VerNeedSec, const Elf_Shdr *VerDefSec) const
bool isLE () const
bool isMipsELF64 () const
bool isMips64EL () const
Expected< Elf_Shdr_Range > sections () const
Expected< Elf_Dyn_Range > dynamicEntries () const
Expected< const uint8_t * > toMappedAddr (uint64_t VAddr, WarningHandler WarnHandler=&defaultWarningHandler) const
Expected< Elf_Sym_Range > symbols (const Elf_Shdr *Sec) const
Expected< Elf_Rela_Range > relas (const Elf_Shdr &Sec) const
Expected< Elf_Rel_Range > rels (const Elf_Shdr &Sec) const
Expected< Elf_Relr_Range > relrs (const Elf_Shdr &Sec) const
std::vector< Elf_Rel > decode_relrs (Elf_Relr_Range relrs) const
Expected< uint64_t > getCrelHeader (ArrayRef< uint8_t > Content) const
Expected< RelsOrRelas > decodeCrel (ArrayRef< uint8_t > Content) const
Expected< RelsOrRelas > crels (const Elf_Shdr &Sec) const
Expected< std::vector< Elf_Rela > > android_relas (const Elf_Shdr &Sec) const
Expected< Elf_Phdr_Range > program_headers () const
Iterate over program header table.
Elf_Note_Iterator notes_begin (const Elf_Phdr &Phdr, Error &Err) const
Get an iterator over notes in a program header.
Elf_Note_Iterator notes_begin (const Elf_Shdr &Shdr, Error &Err) const
Get an iterator over notes in a section.
Elf_Note_Iterator notes_end () const
Get the end iterator for notes.
iterator_range< Elf_Note_Iterator > notes (const Elf_Phdr &Phdr, Error &Err) const
Get an iterator range over notes of a program header.
iterator_range< Elf_Note_Iterator > notes (const Elf_Shdr &Shdr, Error &Err) const
Get an iterator range over notes of a section.
Expected< StringRef > getSectionStringTable (Elf_Shdr_Range Sections, WarningHandler WarnHandler=&defaultWarningHandler) const
Expected< uint32_t > getSectionIndex (const Elf_Sym &Sym, Elf_Sym_Range Syms, DataRegion< Elf_Word > ShndxTable) const
Expected< const Elf_Shdr * > getSection (const Elf_Sym &Sym, const Elf_Shdr *SymTab, DataRegion< Elf_Word > ShndxTable) const
Expected< const Elf_Shdr * > getSection (const Elf_Sym &Sym, Elf_Sym_Range Symtab, DataRegion< Elf_Word > ShndxTable) const
Expected< const Elf_Shdr * > getSection (uint32_t Index) const
Expected< const Elf_Sym * > getSymbol (const Elf_Shdr *Sec, uint32_t Index) const
Expected< StringRef > getSectionName (const Elf_Shdr &Section, WarningHandler WarnHandler=&defaultWarningHandler) const
Expected< StringRef > getSectionName (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
Expected< ArrayRef< uint8_t > > getSegmentContents (const Elf_Phdr &Phdr) const
Expected< std::vector< BBAddrMap > > decodeBBAddrMap (const Elf_Shdr &Sec, const Elf_Shdr *RelaSec=nullptr, std::vector< PGOAnalysisMap > *PGOAnalyses=nullptr) const
Returns a vector of BBAddrMap structs corresponding to each function within the text section that the SHT_LLVM_BB_ADDR_MAP section Sec is associated with.
Expected< MapVector< const Elf_Shdr *, const Elf_Shdr * > > getSectionAndRelocations (std::function< Expected< bool >(const Elf_Shdr &)> IsMatch) const
Returns a map from every section matching IsMatch to its relocation section, or nullptr if it has no relocation section.
void createFakeSections ()
Used by llvm-objdump -d (which needs sections for disassembly) to disassemble objects without a section header table (e.g.

template
class llvm::objcopy:🧝:ELFFile< ELFT >

Definition at line 257 of file ELF.h.

β—† RelsOrRelas

template

using llvm::object::ELFFile< ELFT >::RelsOrRelas = std::pair<std::vector<Elf_Rel>, std::vector<Elf_Rela>>

Definition at line 415 of file ELF.h.

β—† WarningHandler

β—† ELFFile() [1/2]

β—† ELFFile() [2/2]

β—† android_relas()

template

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

β—† base()

β—† create()

β—† createFakeSections()

Used by llvm-objdump -d (which needs sections for disassembly) to disassemble objects without a section header table (e.g.

ET_CORE objects analyzed by linux perf or ET_EXEC with llvm-strip –strip-sections).

Definition at line 976 of file ELF.h.

β—† crels()

β—† decode_relrs()

template

std::vector< typename ELFT::Rel > ELFFile::decode_relrs ( Elf_Relr_Range relrs ) const

β—† decodeBBAddrMap()

Returns a vector of BBAddrMap structs corresponding to each function within the text section that the SHT_LLVM_BB_ADDR_MAP section Sec is associated with.

If the current ELFFile is relocatable, a corresponding RelaSec must be passed in as an argument. Optional out variable to collect all PGO Analyses. New elements are only added if no error occurs. If not provided, the PGO Analyses are decoded then ignored.

Definition at line 1011 of file ELF.cpp.

β—† decodeCrel()

β—† dynamicEntries()

template

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

β—† end()

β—† getBufSize()

β—† getCrelHeader()

β—† getDynamicTagAsString() [1/2]

template

std::string ELFFile::getDynamicTagAsString ( uint64_t Type ) const

β—† getDynamicTagAsString() [2/2]

template

std::string ELFFile::getDynamicTagAsString ( unsigned Arch,
uint64_t Type ) const

β—† getDynSymtabSize()

This function determines the number of dynamic symbols.

It reads section headers first. If section headers are not available, the number of symbols will be inferred by parsing dynamic hash tables.

Definition at line 873 of file ELF.h.

β—† getEntry() [1/2]

template

template<typename T>

Definition at line 1067 of file ELF.h.

β—† getEntry() [2/2]

template

template<typename T>

Definition at line 1057 of file ELF.h.

β—† getHeader()

β—† getLinkAsStrtab()

β—† getPhNum()

β—† getRelativeRelocationType()

β—† getRelocationSymbol()

Get the symbol for a given relocation.

Definition at line 808 of file ELF.h.

β—† getRelocationTypeName() [1/2]

β—† getRelocationTypeName() [2/2]

β—† getSection() [1/3]

β—† getSection() [2/3]

β—† getSection() [3/3]

β—† getSectionAndRelocations()

Returns a map from every section matching IsMatch to its relocation section, or nullptr if it has no relocation section.

This function returns an error if any of the IsMatch calls fail or if it fails to retrieve the content section of any relocation section.

Definition at line 1024 of file ELF.cpp.

β—† getSectionContents()

β—† getSectionContentsAsArray()

β—† getSectionIndex()

β—† getSectionName() [1/2]

β—† getSectionName() [2/2]

β—† getSectionStringTable()

β—† getSegmentContents()

β—† getSHNDXTable() [1/2]

β—† getSHNDXTable() [2/2]

β—† getShNum()

β—† getShStrNdx()

β—† getStringTable()

β—† getStringTableForSymtab() [1/2]

β—† getStringTableForSymtab() [2/2]

β—† getSymbol()

β—† getSymbolVersionByIndex()

β—† getVersionDefinitions()

β—† getVersionDependencies()

β—† isLE()

β—† isMips64EL()

β—† isMipsELF64()

β—† loadVersionMap()

β—† notes() [1/2]

Get an iterator range over notes of a program header.

The program header must be of type PT_NOTE.

Parameters

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

Definition at line 514 of file ELF.h.

β—† notes() [2/2]

Get an iterator range over notes of a section.

The section must be of type SHT_NOTE.

Parameters

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

Definition at line 526 of file ELF.h.

β—† notes_begin() [1/2]

Get an iterator over notes in a program header.

The program header must be of type PT_NOTE.

Parameters

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

Definition at line 452 of file ELF.h.

β—† notes_begin() [2/2]

Get an iterator over notes in a section.

The section must be of type SHT_NOTE.

Parameters

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

Definition at line 481 of file ELF.h.

β—† notes_end()

Get the end iterator for notes.

Definition at line 503 of file ELF.h.

β—† operator=()

β—† program_headers()

Iterate over program header table.

Definition at line 422 of file ELF.h.

β—† relas()

β—† relrs()

β—† rels()

β—† sections()

β—† symbols()

β—† toMappedAddr()


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