ROSE  0.9.6a
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
BinaryLoaderElfObj Class Reference

A loader suitable for ELF object files. More...

#include <BinaryLoaderElfObj.h>

Inheritance diagram for BinaryLoaderElfObj:
Collaboration diagram for BinaryLoaderElfObj:

Public Member Functions

 BinaryLoaderElfObj ()
 
 BinaryLoaderElfObj (const BinaryLoaderElfObj &other)
 
virtual ~BinaryLoaderElfObj ()
 
virtual BinaryLoaderElfObjclone () const
 Copy constructor. More...
 
virtual bool can_load (SgAsmGenericHeader *) const
 Capability query. More...
 
virtual SgAsmGenericSectionPtrList get_remap_sections (SgAsmGenericHeader *)
 Same as super class but appends those sections that are not mapped but which contain code. More...
 
virtual MappingContribution align_values (SgAsmGenericSection *, MemoryMap *, rose_addr_t *malign_lo, rose_addr_t *malign_hi, rose_addr_t *va, rose_addr_t *mem_size, rose_addr_t *offset, rose_addr_t *file_size, bool *map_private, rose_addr_t *va_offset, bool *anon_lo, bool *anon_hi, ConflictResolution *resolve)
 Same as super class but relaxes alignment constraints for sections that are ELF Sections but not ELF Segments. More...
 
- Public Member Functions inherited from BinaryLoaderElf
 BinaryLoaderElf ()
 
 BinaryLoaderElf (const BinaryLoaderElf &other)
 
virtual ~BinaryLoaderElf ()
 
void add_lib_defaults (SgAsmGenericHeader *header=NULL)
 Sets up library search paths and preloads from the environment. More...
 
virtual void fixup (SgAsmInterpretation *interp, FixupErrors *errors=NULL)
 Performs relocation fixups on the specified interpretation. More...
 
virtual SgAsmGenericSectionfind_section_by_preferred_va (SgAsmGenericHeader *, rose_addr_t va)
 Find the section containing the specified virtual address. More...
 
- Public Member Functions inherited from BinaryLoader
 BinaryLoader ()
 
 BinaryLoader (const BinaryLoader &other)
 
virtual ~BinaryLoader ()
 
void set_perform_dynamic_linking (bool b)
 Set whether this loader will perform the linking step. More...
 
bool get_perform_dynamic_linking () const
 Returns whether this loader will perform the linking step. More...
 
void set_perform_remap (bool b)
 Set whether this loader will perform the mapping step. More...
 
bool get_perform_remap () const
 Returns whether this loader will perform the mapping step. More...
 
void set_perform_relocations (bool b)
 Set whether this loader will perform the relocation step. More...
 
bool get_perform_relocations () const
 Returns whether this loader will perform the relocation step. More...
 
void set_debug (FILE *f)
 Set whether this loader will emit diagnostics for debugging. More...
 
FILE * get_debug () const
 Returns whether this loader will emit diagnostics for debugging. More...
 
void add_preload (const std::string &libname)
 Adds a library to the list of pre-loaded libraries. More...
 
const std::vector< std::string > & get_preloads () const
 Returns the list of libraries that will be pre-loaded. More...
 
void add_directory (const std::string &dirname)
 Adds a directory to the list of directories searched for libraries. More...
 
void add_directories (const std::vector< std::string > &dirnames)
 Adds directories to the list of directories searched for libraries. More...
 
const std::vector< std::string > & get_directories () const
 Returns the list of shared object search directories. More...
 
virtual std::string find_so_file (const std::string &libname) const
 Given the name of a shared object, return the fully qualified name where the library is located in the file system. More...
 
virtual void load (SgAsmInterpretation *)
 Conditionally parse, map, link, and/or relocate the interpretation according to properties of this loader. More...
 
virtual void link (SgAsmInterpretation *interp)
 Links an interpretation by parsing all shared objects required by that interpretation. More...
 
virtual void remap (SgAsmInterpretation *interp)
 Maps sections of the interpretation into the virtual address space. More...
 
virtual bool is_linked (SgBinaryComposite *composite, const std::string &filename)
 Returns true if the specified file name is already linked into the AST. More...
 
virtual bool is_linked (SgAsmInterpretation *interp, const std::string &filename)
 Returns true if the specified file name is already linked into the AST. More...
 
virtual std::vector< std::string > dependencies (SgAsmGenericHeader *)
 Finds shared object dependencies of a single binary header. More...
 
virtual void remap (MemoryMap *, SgAsmGenericHeader *)
 Remaps the sections for a particular header. More...
 
rose_addr_t bialign (rose_addr_t val1, rose_addr_t align1, rose_addr_t val2, rose_addr_t align2)
 Calculate adjustment to cause two values to be aligned to two different alignments. More...
 
virtual void addSectionsForRemap (SgAsmGenericHeader *header, SgAsmGenericSectionPtrList &allSections)
 Selects those sections which should be layed out by the Loader and inserts them into the allSections argument. More...
 

Additional Inherited Members

- Public Types inherited from BinaryLoaderElf
enum  {
  VER_FLG_BASE =0x1,
  VER_FLG_WEAK =0x2,
  VERSYM_HIDDEN =0x8000
}
 Flags for version definitions and requirements. More...
 
- Static Public Member Functions inherited from BinaryLoaderElf
static void get_dynamic_vars (SgAsmGenericHeader *, std::string &rpath, std::string &runpath)
 Returns the strings associated with certain variables in the ".dynamic" section. More...
 
- Protected Member Functions inherited from BinaryLoaderElf
virtual rose_addr_t rebase (MemoryMap *, SgAsmGenericHeader *, const SgAsmGenericSectionPtrList &)
 Returns a new, temporary base address which is greater than everything that's been mapped already. More...
 
void build_master_symbol_table (SgAsmInterpretation *)
 Builds the master symbol table. More...
 
SgAsmElfSymbolfixup_info_reloc_symbol (SgAsmElfRelocEntry *, const SymverResolver &)
 Returns the defining symbol for a relocation, if any. More...
 
rose_addr_t fixup_info_target_va (SgAsmElfRelocEntry *, SgAsmGenericSection **section_p=NULL, rose_addr_t *adj_p=NULL)
 Returns the virtual address where a relocation should be supplied. More...
 
rose_addr_t fixup_info_symbol_va (SgAsmElfSymbol *, SgAsmGenericSection **section_p=NULL, rose_addr_t *adj_p=NULL)
 Returns the virtual address of a symbol adjusted for remapping. More...
 
rose_addr_t fixup_info_addend (SgAsmElfRelocEntry *, rose_addr_t target_va, MemoryMap *, size_t nbytes=0)
 Returns the addend associated with a relocation. More...
 
rose_addr_t fixup_info_expr (const std::string &expression, SgAsmElfRelocEntry *reloc, const SymverResolver &resolver, MemoryMap *memmap, rose_addr_t *target_va_p=NULL)
 Evaluates a simple postfix expression and returns the result. More...
 
void fixup_apply (rose_addr_t value, SgAsmElfRelocEntry *, MemoryMap *, rose_addr_t target_va=0, size_t nbytes=0)
 Writes a value into memory at the relocation target. More...
 
void fixup_apply_symbol_copy (SgAsmElfRelocEntry *, const SymverResolver &, MemoryMap *)
 Copies symbol memory to the relocation target. More...
 
void performRelocation (SgAsmElfRelocEntry *, const SymverResolver &, MemoryMap *)
 
void performRelocations (SgAsmElfFileHeader *, MemoryMap *)
 
- Protected Attributes inherited from BinaryLoaderElf
SymbolMap p_symbols
 Symbol table for an entire interpretation. More...
 

Detailed Description

A loader suitable for ELF object files.

An ELF object file typically contains one section per function and each section has a preferred virtual address of zero. This loader will map these sections so they do not overlap in virtual memory.

Definition at line 10 of file BinaryLoaderElfObj.h.

Constructor & Destructor Documentation

BinaryLoaderElfObj::BinaryLoaderElfObj ( )
inline

Definition at line 12 of file BinaryLoaderElfObj.h.

Referenced by clone().

BinaryLoaderElfObj::BinaryLoaderElfObj ( const BinaryLoaderElfObj other)
inline

Definition at line 14 of file BinaryLoaderElfObj.h.

virtual BinaryLoaderElfObj::~BinaryLoaderElfObj ( )
inlinevirtual

Definition at line 18 of file BinaryLoaderElfObj.h.

Member Function Documentation

virtual BinaryLoaderElfObj* BinaryLoaderElfObj::clone ( ) const
inlinevirtual

Copy constructor.

See super class.

Reimplemented from BinaryLoaderElf.

Definition at line 21 of file BinaryLoaderElfObj.h.

References BinaryLoaderElfObj().

virtual bool BinaryLoaderElfObj::can_load ( SgAsmGenericHeader ) const
virtual

Capability query.

See super class.

Reimplemented from BinaryLoaderElf.

virtual SgAsmGenericSectionPtrList BinaryLoaderElfObj::get_remap_sections ( SgAsmGenericHeader )
virtual

Same as super class but appends those sections that are not mapped but which contain code.

Reimplemented from BinaryLoaderElf.

virtual MappingContribution BinaryLoaderElfObj::align_values ( SgAsmGenericSection ,
MemoryMap ,
rose_addr_t malign_lo,
rose_addr_t malign_hi,
rose_addr_t va,
rose_addr_t mem_size,
rose_addr_t offset,
rose_addr_t file_size,
bool *  map_private,
rose_addr_t va_offset,
bool *  anon_lo,
bool *  anon_hi,
ConflictResolution resolve 
)
virtual

Same as super class but relaxes alignment constraints for sections that are ELF Sections but not ELF Segments.

Reimplemented from BinaryLoaderElf.


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