GitOS
Loading...
Searching...
No Matches
ELFFile Class Reference

#include <ELFFile.hpp>

Public Types

enum  p_flags { PF_X = 0x1 , PF_W = 0x2 , PF_R = 0x4 }
enum  p_type {
  PT_NULL = 0 , PT_LOAD = 1 , PT_DYNAMIC = 2 , PT_INTERP = 3 ,
  PT_NOTE = 4 , PT_SHLIB = 5 , PT_PHDR = 6
}
enum  sh_type {
  SHT_NULL = 0 , SHT_PROGBITS = 1 , SHT_SYMTAB = 2 , SHT_STRTAB = 3 ,
  SHT_RELA = 4 , SHT_HASH = 5 , SHT_DYNAMIC = 6 , SHT_NOTE = 7 ,
  SHT_NOBITS = 8 , SHT_REL = 9 , SHT_SHLIB = 10 , SHT_DYNSYM = 11
}
enum  e_type {
  ET_NONE = 0 , ET_REL = 1 , ET_EXEC = 2 , ET_DYN = 3 ,
  ET_CORE = 4
}
enum  ei_class { ELFCLASSNONE = 0 , ELFCLASS32 = 1 , ELFCLASS64 = 2 }
enum  ei_data { ELFDATANONE = 0 , ELFDATA2LSB = 1 , ELFDATA2MSB = 2 }
typedef uint16_t Elf32_Half
typedef uint32_t Elf32_Word
typedef int32_t Elf32_Sword
typedef uint32_t Elf32_Addr
typedef int32_t Elf32_Off

Public Member Functions

bool is_valid () const
 ELFFile (void *data, size_t size)
 ~ELFFile ()
int parse () const
void * get_entry () const
struct __attribute__ ((__packed__))
struct __attribute__ ((__packed__))
struct __attribute__ ((__packed__))
struct __attribute__ ((__packed__))
struct __attribute__ ((__packed__))
Elf32_Headerget_header () const
Elf32_Phdrget_program_header () const
Elf32_Phdrget_program_header (unsigned int index) const
Elf32_Shdrget_section_header () const
Elf32_Shdrget_section_header (unsigned int index) const
const char * get_string_table () const

Data Fields

 Elf32_Phdr
 Elf32_Shdr
 Elf32_Header
 Elf32_Dyn
 Elf32_Sym

Static Public Attributes

static constexpr char ELF_SIGNATURE [] = { 0x7f, 'E', 'L', 'F' }
static const unsigned int EI_NIDENT = 16
static const unsigned int EI_CLASS = 4
static const unsigned int EI_DATA = 5
static const unsigned int SHN_UNDEF = 0

Member Typedef Documentation

◆ Elf32_Addr

typedef uint32_t Elf32_Addr

◆ Elf32_Half

typedef uint16_t Elf32_Half

◆ Elf32_Off

typedef int32_t Elf32_Off

◆ Elf32_Sword

typedef int32_t Elf32_Sword

◆ Elf32_Word

typedef uint32_t Elf32_Word

Member Enumeration Documentation

◆ e_type

enum e_type
Enumerator
ET_NONE 
ET_REL 
ET_EXEC 
ET_DYN 
ET_CORE 

◆ ei_class

enum ei_class
Enumerator
ELFCLASSNONE 
ELFCLASS32 
ELFCLASS64 

◆ ei_data

enum ei_data
Enumerator
ELFDATANONE 
ELFDATA2LSB 
ELFDATA2MSB 

◆ p_flags

enum p_flags
Enumerator
PF_X 
PF_W 
PF_R 

◆ p_type

enum p_type
Enumerator
PT_NULL 
PT_LOAD 
PT_DYNAMIC 
PT_INTERP 
PT_NOTE 
PT_SHLIB 
PT_PHDR 

◆ sh_type

enum sh_type
Enumerator
SHT_NULL 
SHT_PROGBITS 
SHT_SYMTAB 
SHT_STRTAB 
SHT_RELA 
SHT_HASH 
SHT_DYNAMIC 
SHT_NOTE 
SHT_NOBITS 
SHT_REL 
SHT_SHLIB 
SHT_DYNSYM 

Constructor & Destructor Documentation

◆ ELFFile()

ELFFile ( void * data,
size_t size )

References data, and size.

◆ ~ELFFile()

~ELFFile ( )

References kfree().

Member Function Documentation

◆ __attribute__() [1/5]

struct __attribute__ ( (__packed__) )
inline

◆ __attribute__() [2/5]

struct __attribute__ ( (__packed__) )
inline

◆ __attribute__() [3/5]

struct __attribute__ ( (__packed__) )
inline

◆ __attribute__() [4/5]

struct __attribute__ ( (__packed__) )
inline

◆ __attribute__() [5/5]

struct __attribute__ ( (__packed__) )
inline

References __attribute__().

◆ get_entry()

void * get_entry ( ) const

References get_header().

◆ get_header()

ELFFile::Elf32_Header * get_header ( ) const

References Elf32_Header.

◆ get_program_header() [1/2]

ELFFile::Elf32_Phdr * get_program_header ( ) const

References Elf32_Phdr, and get_header().

◆ get_program_header() [2/2]

ELFFile::Elf32_Phdr * get_program_header ( unsigned int index) const

References Elf32_Phdr, and get_program_header().

◆ get_section_header() [1/2]

ELFFile::Elf32_Shdr * get_section_header ( ) const

References Elf32_Shdr, and get_header().

◆ get_section_header() [2/2]

ELFFile::Elf32_Shdr * get_section_header ( unsigned int index) const

References Elf32_Shdr, and get_section_header().

◆ get_string_table()

const char * get_string_table ( ) const

◆ is_valid()

◆ parse()

int parse ( ) const

References EINFORMAT, and is_valid().

Field Documentation

◆ EI_CLASS

const unsigned int EI_CLASS = 4
static

◆ EI_DATA

const unsigned int EI_DATA = 5
static

◆ EI_NIDENT

const unsigned int EI_NIDENT = 16
static

◆ Elf32_Dyn

Elf32_Dyn

◆ Elf32_Header

Elf32_Header

◆ Elf32_Phdr

Elf32_Phdr

◆ Elf32_Shdr

Elf32_Shdr

◆ Elf32_Sym

Elf32_Sym

◆ ELF_SIGNATURE

char ELF_SIGNATURE[] = { 0x7f, 'E', 'L', 'F' }
staticconstexpr

◆ SHN_UNDEF

const unsigned int SHN_UNDEF = 0
static

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