gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
ElfObject Class Reference

#include <elf_object.hh>

Inheritance diagram for ElfObject:
ObjectFile

Public Member Functions

virtual ~ElfObject ()
 
bool loadSections (PortProxy &mem_proxy, Addr addr_mask=maxAddr, Addr offset=0) override
 
virtual bool loadAllSymbols (SymbolTable *symtab, Addr base=0, Addr offset=0, Addr addr_mask=maxAddr) override
 
virtual bool loadGlobalSymbols (SymbolTable *symtab, Addr base=0, Addr offset=0, Addr addr_mask=maxAddr) override
 
virtual bool loadLocalSymbols (SymbolTable *symtab, Addr base=0, Addr offset=0, Addr addr_mask=maxAddr) override
 
virtual bool loadWeakSymbols (SymbolTable *symtab, Addr base=0, Addr offset=0, Addr addr_mask=maxAddr) override
 
virtual ObjectFilegetInterpreter () const override
 
virtual Addr bias () const override
 
virtual bool relocatable () const override
 
virtual Addr mapSize () const override
 
virtual void updateBias (Addr bias_addr) override
 
virtual bool hasTLS () override
 
Addr programHeaderTable ()
 
uint16_t programHeaderSize ()
 
uint16_t programHeaderCount ()
 
- Public Member Functions inherited from ObjectFile
virtual ~ObjectFile ()
 
Arch getArch () const
 
OpSys getOpSys () const
 
Addr entryPoint () const
 
Addr globalPointer () const
 
Addr textBase () const
 
Addr dataBase () const
 
Addr bssBase () const
 
size_t textSize () const
 
size_t dataSize () const
 
size_t bssSize () const
 
void setTextBase (Addr a)
 

Static Public Member Functions

static ObjectFiletryFile (const std::string &fname, size_t len, uint8_t *data, bool skip_interp_check=false)
 

Protected Types

typedef ObjectFile::Section Segment
 

Protected Member Functions

bool loadSomeSymbols (SymbolTable *symtab, int binding, Addr mask, Addr base, Addr offset)
 Helper functions for loadGlobalSymbols() and loadLocalSymbols(). More...
 
 ElfObject (const std::string &_filename, size_t _len, uint8_t *_data, Arch _arch, OpSys _opSys)
 
void getSections ()
 
bool sectionExists (std::string sec)
 
- Protected Member Functions inherited from ObjectFile
 ObjectFile (const std::string &_filename, size_t _len, uint8_t *_data, Arch _arch, OpSys _opSys)
 
bool loadSection (Section *sec, PortProxy &mem_proxy, Addr mask, Addr offset=0)
 
void setGlobalPointer (Addr global_ptr)
 

Protected Attributes

Addr _programHeaderTable
 
uint16_t _programHeaderSize
 
uint16_t _programHeaderCount
 
std::set< std::string > sectionNames
 
ElfObjectinterpreter
 
Addr ldBias
 
bool relocate
 
Addr ldMin
 
Addr ldMax
 
std::vector< SegmentextraSegments
 
- Protected Attributes inherited from ObjectFile
const std::string filename
 
uint8_t * fileData
 
size_t len
 
Arch arch
 
OpSys opSys
 
Addr entry
 
Addr globalPtr
 
Section text
 
Section data
 
Section bss
 

Additional Inherited Members

- Public Types inherited from ObjectFile
enum  Arch {
  UnknownArch, Alpha, SPARC64, SPARC32,
  Mips, X86_64, I386, Arm64,
  Arm, Thumb, Power, Riscv
}
 
enum  OpSys {
  UnknownOpSys, Tru64, Linux, Solaris,
  LinuxArmOABI, FreeBSD
}
 
- Static Public Attributes inherited from ObjectFile
static const Addr maxAddr = std::numeric_limits<Addr>::max()
 

Detailed Description

Definition at line 51 of file elf_object.hh.

Member Typedef Documentation

Definition at line 55 of file elf_object.hh.

Constructor & Destructor Documentation

ElfObject::ElfObject ( const std::string &  _filename,
size_t  _len,
uint8_t *  _data,
Arch  _arch,
OpSys  _opSys 
)
protected
virtual ElfObject::~ElfObject ( )
inlinevirtual

Definition at line 95 of file elf_object.hh.

Member Function Documentation

virtual Addr ElfObject::bias ( ) const
inlineoverridevirtual

Reimplemented from ObjectFile.

Definition at line 119 of file elf_object.hh.

References ldBias.

virtual ObjectFile* ElfObject::getInterpreter ( ) const
inlineoverridevirtual

Reimplemented from ObjectFile.

Definition at line 117 of file elf_object.hh.

References interpreter.

void ElfObject::getSections ( )
protected

Definition at line 519 of file elf_object.cc.

References ObjectFile::fileData, ObjectFile::len, panic, and sectionNames.

Referenced by sectionExists().

virtual bool ElfObject::hasTLS ( )
inlineoverridevirtual

Reimplemented from ObjectFile.

Definition at line 124 of file elf_object.hh.

References sectionExists().

bool ElfObject::loadAllSymbols ( SymbolTable symtab,
Addr  base = 0,
Addr  offset = 0,
Addr  addr_mask = maxAddr 
)
overridevirtual

Implements ObjectFile.

Definition at line 459 of file elf_object.cc.

References loadGlobalSymbols(), loadLocalSymbols(), and loadWeakSymbols().

bool ElfObject::loadGlobalSymbols ( SymbolTable symtab,
Addr  base = 0,
Addr  offset = 0,
Addr  addr_mask = maxAddr 
)
overridevirtual

Implements ObjectFile.

Definition at line 468 of file elf_object.cc.

References interpreter, and loadSomeSymbols().

Referenced by loadAllSymbols().

bool ElfObject::loadLocalSymbols ( SymbolTable symtab,
Addr  base = 0,
Addr  offset = 0,
Addr  addr_mask = maxAddr 
)
overridevirtual

Implements ObjectFile.

Definition at line 479 of file elf_object.cc.

References interpreter, and loadSomeSymbols().

Referenced by loadAllSymbols().

bool ElfObject::loadSections ( PortProxy mem_proxy,
Addr  addr_mask = maxAddr,
Addr  offset = 0 
)
overridevirtual

Reimplemented from ObjectFile.

Definition at line 501 of file elf_object.cc.

References extraSegments, interpreter, ObjectFile::loadSection(), ObjectFile::loadSections(), loadSections(), and X86ISA::seg.

Referenced by loadSections().

bool ElfObject::loadSomeSymbols ( SymbolTable symtab,
int  binding,
Addr  mask,
Addr  base,
Addr  offset 
)
protected
bool ElfObject::loadWeakSymbols ( SymbolTable symtab,
Addr  base = 0,
Addr  offset = 0,
Addr  addr_mask = maxAddr 
)
overridevirtual

Reimplemented from ObjectFile.

Definition at line 490 of file elf_object.cc.

References interpreter, and loadSomeSymbols().

Referenced by loadAllSymbols().

virtual Addr ElfObject::mapSize ( ) const
inlineoverridevirtual

Reimplemented from ObjectFile.

Definition at line 121 of file elf_object.hh.

References ldMax, and ldMin.

uint16_t ElfObject::programHeaderCount ( )
inline
uint16_t ElfObject::programHeaderSize ( )
inline
Addr ElfObject::programHeaderTable ( )
inline
virtual bool ElfObject::relocatable ( ) const
inlineoverridevirtual

Reimplemented from ObjectFile.

Definition at line 120 of file elf_object.hh.

References relocate.

bool ElfObject::sectionExists ( std::string  sec)
protected

Definition at line 553 of file elf_object.cc.

References getSections(), and sectionNames.

Referenced by hasTLS().

ObjectFile * ElfObject::tryFile ( const std::string &  fname,
size_t  len,
uint8_t *  data,
bool  skip_interp_check = false 
)
static
void ElfObject::updateBias ( Addr  bias_addr)
overridevirtual

Member Data Documentation

uint16_t ElfObject::_programHeaderCount
protected

Definition at line 61 of file elf_object.hh.

Referenced by programHeaderCount(), and tryFile().

uint16_t ElfObject::_programHeaderSize
protected

Definition at line 60 of file elf_object.hh.

Referenced by programHeaderSize(), and tryFile().

Addr ElfObject::_programHeaderTable
protected

Definition at line 59 of file elf_object.hh.

Referenced by programHeaderTable(), and tryFile().

std::vector<Segment> ElfObject::extraSegments
protected

Definition at line 92 of file elf_object.hh.

Referenced by ElfObject(), loadSections(), and updateBias().

ElfObject* ElfObject::interpreter
protected
Addr ElfObject::ldBias
protected

Definition at line 69 of file elf_object.hh.

Referenced by bias(), and updateBias().

Addr ElfObject::ldMax
protected

Definition at line 80 of file elf_object.hh.

Referenced by ElfObject(), and mapSize().

Addr ElfObject::ldMin
protected

Definition at line 79 of file elf_object.hh.

Referenced by ElfObject(), and mapSize().

bool ElfObject::relocate
protected

Definition at line 75 of file elf_object.hh.

Referenced by ElfObject(), and relocatable().

std::set<std::string> ElfObject::sectionNames
protected

Definition at line 62 of file elf_object.hh.

Referenced by getSections(), and sectionExists().


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

Generated on Fri Jun 9 2017 13:04:09 for gem5 by doxygen 1.8.6