The Pedigree Project  0.1
Classes | Public Member Functions | Public Attributes | List of all members
Elf32 Class Reference

#include <Elf32.h>

+ Collaboration diagram for Elf32:

Classes

struct  Elf32Dyn_t
 
struct  Elf32Header_t
 
struct  Elf32ProcessHeader_t
 
struct  Elf32Rel_t
 
struct  Elf32SectionHeader_t
 
struct  Elf32Symbol_t
 

Public Member Functions

 Elf32 (const char *name)
 
 ~Elf32 ()
 
bool load (uint8_t *pBuffer, unsigned int nBufferLength)
 
bool load (BootstrapInfo *pBootstrap)
 
bool writeSections ()
 
unsigned int getLastAddress ()
 
const char * lookupSymbol (unsigned int addr, unsigned int *startAddr=0)
 
uint32_t lookupDynamicSymbolAddress (uint32_t off)
 
char * lookupDynamicSymbolName (uint32_t off)
 
uint32_t getGlobalOffsetTable ()
 
uint32_t getEntryPoint ()
 
 Elf32 (const Elf32 &)
 
Elf32operator= (const Elf32 &)
 
 Elf32 (const char *name)
 
 ~Elf32 ()
 
bool load (uint8_t *pBuffer, unsigned int nBufferLength)
 
bool load (BootstrapInfo *pBootstrap)
 
bool writeSections ()
 
unsigned int getLastAddress ()
 
const char * lookupSymbol (unsigned int addr, unsigned int *startAddr=0)
 
uint32_t lookupDynamicSymbolAddress (uint32_t off)
 
char * lookupDynamicSymbolName (uint32_t off)
 
uint32_t getGlobalOffsetTable ()
 
uint32_t getEntryPoint ()
 
 Elf32 (const Elf32 &)
 
Elf32operator= (const Elf32 &)
 
 Elf32 (const char *name)
 
 ~Elf32 ()
 
bool load (uint8_t *pBuffer, unsigned int nBufferLength)
 
bool load (BootstrapInfo *pBootstrap)
 
bool writeSections ()
 
unsigned int getLastAddress ()
 
const char * lookupSymbol (unsigned int addr, unsigned int *startAddr=0)
 
uint32_t lookupDynamicSymbolAddress (uint32_t off)
 
char * lookupDynamicSymbolName (uint32_t off)
 
uint32_t getGlobalOffsetTable ()
 
uint32_t getEntryPoint ()
 
 Elf32 (const Elf32 &)
 
Elf32operator= (const Elf32 &)
 

Public Attributes

struct Elf32::Elf32Header_t PACKED
 
struct Elf32::Elf32ProcessHeader_t PACKED
 
struct Elf32::Elf32SectionHeader_t PACKED
 
struct Elf32::Elf32Symbol_t PACKED
 
struct Elf32::Elf32Dyn_t PACKED
 
struct Elf32::Elf32Rel_t PACKED
 
Elf32Header_tm_pHeader
 
Elf32SectionHeader_tm_pSymbolTable
 
Elf32SectionHeader_tm_pStringTable
 
Elf32SectionHeader_tm_pShstrtab
 
Elf32SectionHeader_tm_pGotTable
 
Elf32SectionHeader_tm_pRelTable
 
Elf32SectionHeader_tm_pSectionHeaders
 
char m_pId [128]
 
uint8_t * m_pBuffer
 Offset of the file in memory.
 

Detailed Description

Provides an implementation of a 32-bit Executable and Linker format file parser. The ELF data can be loaded either by supplying an entire ELF file in a buffer, or by supplying details of each section seperately.

Note
This class does not copy any section data. The supplied buffer pointers must remain valid throughout the lifespan of this class.

Definition at line 61 of file arm/Elf32.h.

Constructor & Destructor Documentation

Elf32::Elf32 ( const char *  name)

Default constructor - loads no data.

Parameters
nameAn identifier for this ELF file. This is copied into the class.

Definition at line 25 of file boot/arm/Elf32.cc.

Elf32::~Elf32 ( )

Destructor. Doesn't do much.

Definition at line 32 of file boot/arm/Elf32.cc.

Elf32::Elf32 ( const Elf32 )

The copy-constructor

Note
currently not implemented
Elf32::Elf32 ( const char *  name)

Default constructor - loads no data.

Parameters
nameAn identifier for this ELF file. This is copied into the class.
Elf32::~Elf32 ( )

Destructor. Doesn't do much.

Elf32::Elf32 ( const Elf32 )

The copy-constructor

Note
currently not implemented
Elf32::Elf32 ( const char *  name)

Default constructor - loads no data.

Parameters
nameAn identifier for this ELF file. This is copied into the class.
Elf32::~Elf32 ( )

Destructor. Doesn't do much.

Elf32::Elf32 ( const Elf32 )

The copy-constructor

Note
currently not implemented

Member Function Documentation

uint32_t Elf32::getEntryPoint ( )

Returns the entry point of the file.

Definition at line 205 of file boot/arm/Elf32.cc.

uint32_t Elf32::getEntryPoint ( )

Returns the entry point of the file.

uint32_t Elf32::getEntryPoint ( )

Returns the entry point of the file.

uint32_t Elf32::getGlobalOffsetTable ( )

Gets the address of the global offset table.

Returns
Address of the GOT, or 0 if none was found.

Definition at line 200 of file boot/arm/Elf32.cc.

uint32_t Elf32::getGlobalOffsetTable ( )

Gets the address of the global offset table.

Returns
Address of the GOT, or 0 if none was found.
uint32_t Elf32::getGlobalOffsetTable ( )

Gets the address of the global offset table.

Returns
Address of the GOT, or 0 if none was found.
unsigned int Elf32::getLastAddress ( )

Returns the virtual address of the last byte to be written. Used to calculate the sbrk memory breakpoint.

Definition at line 147 of file boot/arm/Elf32.cc.

unsigned int Elf32::getLastAddress ( )

Returns the virtual address of the last byte to be written. Used to calculate the sbrk memory breakpoint.

unsigned int Elf32::getLastAddress ( )

Returns the virtual address of the last byte to be written. Used to calculate the sbrk memory breakpoint.

bool Elf32::load ( uint8_t *  pBuffer,
unsigned int  nBufferLength 
)

Constructs an Elf32 object, and assumes the given pointer to be to a contiguous region of memory containing an ELF object.

Definition at line 36 of file boot/arm/Elf32.cc.

References m_pBuffer.

bool Elf32::load ( uint8_t *  pBuffer,
unsigned int  nBufferLength 
)

Constructs an Elf32 object, and assumes the given pointer to be to a contiguous region of memory containing an ELF object.

bool Elf32::load ( uint8_t *  pBuffer,
unsigned int  nBufferLength 
)

Constructs an Elf32 object, and assumes the given pointer to be to a contiguous region of memory containing an ELF object.

bool Elf32::load ( BootstrapInfo *  pBootstrap)

Extracts the symbol and string tables from the given BootstrapInfo class.

bool Elf32::load ( BootstrapInfo *  pBootstrap)

Extracts the symbol and string tables from the given BootstrapInfo class.

bool Elf32::load ( BootstrapInfo *  pBootstrap)

Extracts the symbol and string tables from the given BootstrapInfo class.

uint32_t Elf32::lookupDynamicSymbolAddress ( uint32_t  off)

Returns the address of the symbol with offset 'off' in the dynamic relocation table.

Definition at line 190 of file boot/arm/Elf32.cc.

uint32_t Elf32::lookupDynamicSymbolAddress ( uint32_t  off)

Returns the address of the symbol with offset 'off' in the dynamic relocation table.

uint32_t Elf32::lookupDynamicSymbolAddress ( uint32_t  off)

Returns the address of the symbol with offset 'off' in the dynamic relocation table.

char * Elf32::lookupDynamicSymbolName ( uint32_t  off)

Returns a NULL terminated string specifying the name of the symbol at offset 'off' in the relocation symbol table.

Definition at line 195 of file boot/arm/Elf32.cc.

char* Elf32::lookupDynamicSymbolName ( uint32_t  off)

Returns a NULL terminated string specifying the name of the symbol at offset 'off' in the relocation symbol table.

char* Elf32::lookupDynamicSymbolName ( uint32_t  off)

Returns a NULL terminated string specifying the name of the symbol at offset 'off' in the relocation symbol table.

const char * Elf32::lookupSymbol ( unsigned int  addr,
unsigned int *  startAddr = 0 
)

Returns the name of the symbol which contains 'addr', and also the starting address of that symbol in 'startAddr' if startAddr != 0.

Parameters
[in]addrThe address to look up.
[out]startAddrThe starting address of the found symbol (optional).
Returns
The symbol name, as a C string.

Definition at line 152 of file boot/arm/Elf32.cc.

References m_pBuffer.

const char* Elf32::lookupSymbol ( unsigned int  addr,
unsigned int *  startAddr = 0 
)

Returns the name of the symbol which contains 'addr', and also the starting address of that symbol in 'startAddr' if startAddr != 0.

Parameters
[in]addrThe address to look up.
[out]startAddrThe starting address of the found symbol (optional).
Returns
The symbol name, as a C string.
const char* Elf32::lookupSymbol ( unsigned int  addr,
unsigned int *  startAddr = 0 
)

Returns the name of the symbol which contains 'addr', and also the starting address of that symbol in 'startAddr' if startAddr != 0.

Parameters
[in]addrThe address to look up.
[out]startAddrThe starting address of the found symbol (optional).
Returns
The symbol name, as a C string.
Elf32& Elf32::operator= ( const Elf32 )

The assignment operator

Note
currently not implemented
Elf32& Elf32::operator= ( const Elf32 )

The assignment operator

Note
currently not implemented
Elf32& Elf32::operator= ( const Elf32 )

The assignment operator

Note
currently not implemented
bool Elf32::writeSections ( )

Writes all writeable sections to their virtual addresses.

Returns
True on success.

Definition at line 119 of file boot/arm/Elf32.cc.

References m_pBuffer.

bool Elf32::writeSections ( )

Writes all writeable sections to their virtual addresses.

Returns
True on success.
bool Elf32::writeSections ( )

Writes all writeable sections to their virtual addresses.

Returns
True on success.

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