LIEF: Library to Instrument Executable Formats Version
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
LIEF::ELF::Header Class Reference

Class which represents the ELF's header. This is the ELF structure that starts an ELF file. More...

#include <Header.hpp>

Inheritance diagram for LIEF::ELF::Header:
Inheritance graph
[legend]
Collaboration diagram for LIEF::ELF::Header:
Collaboration graph
[legend]

Public Types

using identity_t = std::array< uint8_t, 16 >
 
using abstract_architecture_t = std::pair< ARCHITECTURES, std::set< MODES > >
 
template<class T >
using flags_list_t = std::set< T >
 
using arm_flags_list_t = flags_list_t< ARM_EFLAGS >
 
using mips_flags_list_t = flags_list_t< MIPS_EFLAGS >
 
using hexagon_flags_list_t = flags_list_t< HEXAGON_EFLAGS >
 
using ppc64_flags_list_t = flags_list_t< PPC64_EFLAGS >
 
using loongarch_flags_list_t = flags_list_t< LOONGARCH_EFLAGS >
 
- 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 (const details::Elf32_Ehdr &header)
 
 Header (const details::Elf64_Ehdr &header)
 
Headeroperator= (const Header &)
 
 Header (const Header &)
 
E_TYPE file_type () const
 Define the object file type. (e.g. executable, library...)
 
OBJECT_TYPES abstract_object_type () const
 LIEF abstract object type.
 
ARCH machine_type () const
 Target architecture.
 
abstract_architecture_t abstract_architecture () const
 LIEF abstract architecture.
 
ENDIANNESS abstract_endianness () const
 LIEF abstract endianness.
 
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 program table (also known as segments table)
 
uint64_t section_headers_offset () const
 Offset of section table.
 
uint32_t processor_flag () const
 Processor-specific flags.
 
bool has (ARM_EFLAGS f) const
 Check if the given flag is present in processor_flag()
 
arm_flags_list_t arm_flags_list () const
 Return a list of ARM_EFLAGS present in processor_flag()
 
bool has (MIPS_EFLAGS f) const
 Check if the given flag is present in processor_flag()
 
mips_flags_list_t mips_flags_list () const
 Return a list of MIPS_EFLAGS present in processor_flag()
 
bool has (PPC64_EFLAGS f) const
 Check if the given flag is present in processor_flag()
 
ppc64_flags_list_t ppc64_flags_list () const
 Return a list of PPC64_EFLAGS present in processor_flag()
 
bool has (HEXAGON_EFLAGS f) const
 Check if the given flag is present in processor_flag()
 
hexagon_flags_list_t hexagon_flags_list () const
 Return a list of HEXAGON_EFLAGS present in processor_flag()
 
bool has (LOONGARCH_EFLAGS f) const
 Check if the given flag is present in processor_flag()
 
loongarch_flags_list_t loongarch_flags_list () const
 Return a list of LOONGARCH_EFLAGS present in processor_flag()
 
uint32_t header_size () const
 Size of the current header.
 
uint32_t program_header_size () const
 Return the size of a Segment header
 
uint32_t numberof_segments () const
 Return the the number of segments.
 
uint32_t section_header_size () const
 Return the size of a Section header
 
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
 
ELF_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.
 
void file_type (E_TYPE type)
 
void machine_type (ARCH machineType)
 
void object_file_version (VERSION version)
 
void entrypoint (uint64_t entryPoint)
 
void program_headers_offset (uint64_t programHeaderOffset)
 
void section_headers_offset (uint64_t sectionHeaderOffset)
 
void processor_flag (uint32_t processorFlag)
 
void header_size (uint32_t headerSize)
 
void program_header_size (uint32_t programHeaderSize)
 
void numberof_segments (uint32_t n)
 
void section_header_size (uint32_t sizeOfSectionHeaderEntries)
 
void numberof_sections (uint32_t n)
 
void section_name_table_idx (uint32_t sectionNameStringTableIdx)
 
void identity (const std::string &identity)
 
void identity (const identity_t &identity)
 
void identity_class (ELF_CLASS i_class)
 
void identity_data (ELF_DATA data)
 
void identity_version (VERSION version)
 
void identity_os_abi (OS_ABI osabi)
 
void identity_abi_version (uint32_t version)
 
void accept (Visitor &visitor) const override
 
- Public Member Functions inherited from LIEF::Object
 Object (const Object &other)
 
Objectoperator= (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
 

Detailed Description

Class which represents the ELF's header. This is the ELF structure that starts an ELF file.

Member Function Documentation

◆ abstract_architecture()

abstract_architecture_t LIEF::ELF::Header::abstract_architecture ( ) const

LIEF abstract architecture.

It returns Empty if it can't be abstracted

◆ accept()

void LIEF::ELF::Header::accept ( Visitor visitor) const
overridevirtual

Implements LIEF::Object.

◆ header_size()

uint32_t LIEF::ELF::Header::header_size ( ) const

Size of the current header.

This size should be 64 for an ELF64 binary and 52 for an ELF32.

◆ identity_version()

VERSION LIEF::ELF::Header::identity_version ( ) const

◆ numberof_sections()

uint32_t LIEF::ELF::Header::numberof_sections ( ) const

Return the number of sections.

Warning
This value could differ from the real number of sections present in the binary. It must be taken as an indication

◆ program_header_size()

uint32_t LIEF::ELF::Header::program_header_size ( ) const

Return the size of a Segment header

This size should be 56 for a ELF64 binary and 32 for an ELF32.

◆ section_header_size()

uint32_t LIEF::ELF::Header::section_header_size ( ) const

Return the size of a Section header

This size should be 64 for a ELF64 binary and 40 for an ELF32.


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