LIEF: Library to Instrument Executable Formats Version 0.16.0
|
Class which represents the ELF's header. This class mirrors the raw ELF Elfxx_Ehdr
structure.
More...
#include <Header.hpp>
Public Types | |
enum | ELF_INDENT { ELI_MAG0 = 0 , ELI_MAG1 = 1 , ELI_MAG2 = 2 , ELI_MAG3 = 3 , ELI_CLASS = 4 , ELI_DATA = 5 , ELI_VERSION = 6 , ELI_OSABI = 7 , ELI_ABIVERSION = 8 , ELI_PAD = 9 , ELI_NIDENT = 16 } |
e_ident size and indices. More... | |
enum class | FILE_TYPE { NONE = 0 , REL = 1 , EXEC = 2 , DYN = 3 , CORE = 4 } |
The type of the underlying ELF file. This enum matches the semantic of ET_NONE , ET_REL , ... More... | |
enum class | VERSION { NONE = 0 , CURRENT = 1 } |
Match the result of Elfxx_Ehdr.e_version More... | |
enum class | CLASS { NONE = 0 , ELF32 , ELF64 } |
Match the result of Elfxx_Ehdr.e_ident[EI_CLASS] More... | |
enum class | OS_ABI { SYSTEMV = 0 , HPUX = 1 , NETBSD = 2 , GNU = 3 , LINUX = 3 , HURD = 4 , SOLARIS = 6 , AIX = 7 , IRIX = 8 , FREEBSD = 9 , TRU64 = 10 , MODESTO = 11 , OPENBSD = 12 , OPENVMS = 13 , NSK = 14 , AROS = 15 , FENIXOS = 16 , CLOUDABI = 17 , C6000_ELFABI = 64 , AMDGPU_HSA = 64 , C6000_LINUX = 65 , ARM = 97 , STANDALONE = 255 } |
Match the result Elfxx_Ehdr.e_ident[EI_OSABI] More... | |
enum class | ELF_DATA { NONE = 0 , LSB = 1 , MSB = 2 } |
Match the result Elfxx_Ehdr.e_ident[EI_DATA] More... | |
using | identity_t = std::array<uint8_t, 16> |
Public Types inherited from LIEF::Object | |
template<class T > | |
using | output_t = add_pointer_t<decay_t<T>> |
template<class T > | |
using | output_const_t = add_pointer_t<add_const_t<decay_t<T>>> |
Public Member Functions | |
Header ()=default | |
Header & | operator= (const Header &)=default |
Header (const Header &)=default | |
~Header () override=default | |
FILE_TYPE | file_type () const |
Define the object file type. (e.g. executable, library...) | |
ARCH | machine_type () const |
Target architecture. | |
VERSION | object_file_version () const |
Version of the object file format. | |
uint64_t | entrypoint () const |
Executable entrypoint. | |
uint64_t | program_headers_offset () const |
Offset of the programs table (also known as segments table) | |
uint64_t | section_headers_offset () const |
Offset of the sections table. | |
uint32_t | processor_flag () const |
Processor-specific flags. | |
uint32_t | header_size () const |
Size of the current header (i.e. sizeof(Elfxx_Ehdr) ) This size should be 64 for an ELF64 binary and 52 for an ELF32 . | |
uint32_t | program_header_size () const |
Return the size of a program header (i.e. sizeof(Elfxx_Phdr) ) This size should be 56 for an ELF64 binary and 32 for an ELF32 . | |
uint32_t | numberof_segments () const |
Return the number of segments. | |
uint32_t | section_header_size () const |
Return the size of a section header (i.e. sizeof(Elfxx_Shdr) ) This size should be 64 for a ELF64 binary and 40 for an ELF32 . | |
uint32_t | numberof_sections () const |
Return the number of sections. | |
uint32_t | section_name_table_idx () const |
Return the section's index which contains sections' names. | |
identity_t & | identity () |
Return the ELF identity as an std::array | |
const identity_t & | identity () const |
CLASS | identity_class () const |
Return the object's class. ELF64 or ELF32 | |
ELF_DATA | identity_data () const |
Specify the data encoding. | |
VERSION | identity_version () const |
OS_ABI | identity_os_abi () const |
Identifies the version of the ABI for which the object is prepared. | |
uint32_t | identity_abi_version () const |
ABI Version. | |
bool | has (PROCESSOR_FLAGS flag) const |
std::vector< PROCESSOR_FLAGS > | flags_list () const |
void | file_type (FILE_TYPE type) |
void | machine_type (ARCH arch) |
void | object_file_version (VERSION version) |
void | entrypoint (uint64_t entry) |
void | program_headers_offset (uint64_t offset) |
void | section_headers_offset (uint64_t offset) |
void | processor_flag (uint32_t flags) |
void | header_size (uint32_t size) |
void | program_header_size (uint32_t size) |
void | numberof_segments (uint32_t n) |
void | section_header_size (uint32_t size) |
void | numberof_sections (uint32_t n) |
void | section_name_table_idx (uint32_t idx) |
void | identity (const std::string &identity) |
void | identity (const identity_t &identity) |
void | identity_class (CLASS cls) |
void | identity_data (ELF_DATA data) |
void | identity_version (VERSION version) |
void | identity_os_abi (OS_ABI osabi) |
void | identity_abi_version (uint8_t version) |
void | accept (Visitor &visitor) const override |
Public Member Functions inherited from LIEF::Object | |
Object () | |
Object (const Object &other) | |
Object & | operator= (const Object &other) |
template<class T > | |
output_t< T > | as () |
template<class T > | |
output_const_t< T > | as () const |
virtual bool | operator== (const Object &other) const |
virtual bool | operator!= (const Object &other) const |
virtual | ~Object () |
using LIEF::ELF::Header::identity_t = std::array<uint8_t, 16> |
|
strong |
|
strong |
e_ident size and indices.
|
strong |
The type of the underlying ELF file. This enum matches the semantic of ET_NONE
, ET_REL
, ...
Enumerator | |
---|---|
NONE | Can't be determined. |
REL | Relocatable file (or object file) |
EXEC | non-pie executable |
DYN | Shared library or a pie-executable. |
CORE | Core dump file. |
|
strong |
Match the result Elfxx_Ehdr.e_ident[EI_OSABI]
|
strong |
Match the result of Elfxx_Ehdr.e_version
Enumerator | |
---|---|
NONE | Invalid ELF version. |
CURRENT | Current version (default) |
|
default |
|
default |
|
overridedefault |
|
overridevirtual |
Implements LIEF::Object.
|
inline |
Executable entrypoint.
|
inline |
|
inline |
Define the object file type. (e.g. executable, library...)
|
inline |
std::vector< PROCESSOR_FLAGS > LIEF::ELF::Header::flags_list | ( | ) | const |
bool LIEF::ELF::Header::has | ( | PROCESSOR_FLAGS | flag | ) | const |
|
inline |
Size of the current header (i.e. sizeof(Elfxx_Ehdr)
) This size should be 64 for an ELF64
binary and 52 for an ELF32
.
|
inline |
|
inline |
Return the ELF identity as an std::array
|
inline |
void LIEF::ELF::Header::identity | ( | const identity_t & | identity | ) |
void LIEF::ELF::Header::identity | ( | const std::string & | identity | ) |
|
inline |
ABI Version.
|
inline |
|
inline |
Return the object's class. ELF64
or ELF32
|
inline |
|
inline |
Specify the data encoding.
|
inline |
|
inline |
Identifies the version of the ABI for which the object is prepared.
|
inline |
|
inline |
|
inline |
|
inline |
Target architecture.
|
inline |
|
inline |
Return the number of sections.
|
inline |
|
inline |
Return the number of segments.
|
inline |
|
inline |
Version of the object file format.
|
inline |
|
inline |
Processor-specific flags.
|
inline |
|
inline |
Return the size of a program header (i.e. sizeof(Elfxx_Phdr)
) This size should be 56 for an ELF64
binary and 32 for an ELF32
.
|
inline |
|
inline |
Offset of the programs table (also known as segments table)
|
inline |
|
inline |
Return the size of a section header (i.e. sizeof(Elfxx_Shdr)
) This size should be 64 for a ELF64
binary and 40 for an ELF32
.
|
inline |
|
inline |
Offset of the sections table.
|
inline |
|
inline |
Return the section's index which contains sections' names.
|
inline |