ROSE  0.9.11.56
Namespaces | Classes | Functions
Rose::BinaryAnalysis::Partitioner2::ModulesElf Namespace Reference

Description

Disassembly and partitioning utility functions for ELF.

Namespaces

 FixUndefinedSymbols
 Boolean flag for tryLink.
 

Classes

struct  PltEntryMatcher
 Matches an ELF PLT entry. More...
 

Functions

std::vector< SgAsmElfSection * > findSectionsByName (SgAsmInterpretation *, const std::string &)
 Get a list of all ELF sections by name. More...
 
bool isImport (const Partitioner &, const Function::Ptr &)
 True if the function is an import. More...
 
bool isLinkedImport (const Partitioner &, const Function::Ptr &)
 True if function is a linked import. More...
 
bool isUnlinkedImport (const Partitioner &, const Function::Ptr &)
 True if function is a non-linked import. More...
 
bool isObjectFile (const boost::filesystem::path &)
 True if named file is an ELF object file. More...
 
bool isStaticArchive (const boost::filesystem::path &)
 True if named file is a static library archive. More...
 
bool tryLink (const std::string &command, const boost::filesystem::path &outputName, std::vector< boost::filesystem::path > inputNames, Sawyer::Message::Stream &errors, FixUndefinedSymbols::Boolean fixUndefinedSymbols=FixUndefinedSymbols::YES)
 Try to run a link command. More...
 
std::vector< boost::filesystem::path > extractStaticArchive (const boost::filesystem::path &directory, const boost::filesystem::path &archive)
 Extract object files from a static archive. More...
 
void buildMayReturnLists (Partitioner &)
 Build may-return white and black lists. More...
 
std::vector< Function::PtrfindErrorHandlingFunctions (SgAsmElfFileHeader *)
 Reads ELF .eh_frames to find function entry addresses. More...
 
std::vector< Function::PtrfindErrorHandlingFunctions (SgAsmInterpretation *)
 Reads ELF .eh_frames to find function entry addresses. More...
 
size_t findErrorHandlingFunctions (SgAsmElfFileHeader *, std::vector< Function::Ptr > &)
 Reads ELF .eh_frames to find function entry addresses. More...
 
std::vector< Function::PtrfindPltFunctions (const Partitioner &, SgAsmElfFileHeader *)
 Reads ELF PLT sections and returns a list of functions.
 
std::vector< Function::PtrfindPltFunctions (const Partitioner &, SgAsmInterpretation *)
 Reads ELF PLT sections and returns a list of functions.
 
size_t findPltFunctions (const Partitioner &, SgAsmElfFileHeader *, std::vector< Function::Ptr > &)
 Reads ELF PLT sections and returns a list of functions.
 

Function Documentation

std::vector<Function::Ptr> Rose::BinaryAnalysis::Partitioner2::ModulesElf::findErrorHandlingFunctions ( SgAsmElfFileHeader )

Reads ELF .eh_frames to find function entry addresses.

Performs an AST traversal rooted at the specified ast to find ELF .eh_frames sections and returns a sorted list of functions at unique starting addresses. The functions are not attached to the CFG/AUM.

std::vector<Function::Ptr> Rose::BinaryAnalysis::Partitioner2::ModulesElf::findErrorHandlingFunctions ( SgAsmInterpretation )

Reads ELF .eh_frames to find function entry addresses.

Performs an AST traversal rooted at the specified ast to find ELF .eh_frames sections and returns a sorted list of functions at unique starting addresses. The functions are not attached to the CFG/AUM.

size_t Rose::BinaryAnalysis::Partitioner2::ModulesElf::findErrorHandlingFunctions ( SgAsmElfFileHeader ,
std::vector< Function::Ptr > &   
)

Reads ELF .eh_frames to find function entry addresses.

Performs an AST traversal rooted at the specified ast to find ELF .eh_frames sections and returns a sorted list of functions at unique starting addresses. The functions are not attached to the CFG/AUM.

std::vector<SgAsmElfSection*> Rose::BinaryAnalysis::Partitioner2::ModulesElf::findSectionsByName ( SgAsmInterpretation ,
const std::string &   
)

Get a list of all ELF sections by name.

Returns an empty list if the interpretation is null or it doesn't have any sections that match the specified name.

bool Rose::BinaryAnalysis::Partitioner2::ModulesElf::isImport ( const Partitioner ,
const Function::Ptr  
)

True if the function is an import.

True if the specified function is an import, whether it's actually been linked in or not. This is a weaker version of isLinkedImport.

bool Rose::BinaryAnalysis::Partitioner2::ModulesElf::isLinkedImport ( const Partitioner ,
const Function::Ptr  
)

True if function is a linked import.

Returns true if the specified function is an import which has been linked to an actual function. This is a stronger version of isImport.

bool Rose::BinaryAnalysis::Partitioner2::ModulesElf::isUnlinkedImport ( const Partitioner ,
const Function::Ptr  
)

True if function is a non-linked import.

Returns true if the specified function is an import function but has not been linked in yet.

bool Rose::BinaryAnalysis::Partitioner2::ModulesElf::isObjectFile ( const boost::filesystem::path &  )

True if named file is an ELF object file.

Object files usually have names with a ".o" extension, although this function actually tries to open the file and parse some ELF data structures to make that determination.

bool Rose::BinaryAnalysis::Partitioner2::ModulesElf::isStaticArchive ( const boost::filesystem::path &  )

True if named file is a static library archive.

Archives usually have names ending with a ".a" extension, although this function actually tries to open the file and parse the header to make that determination.

bool Rose::BinaryAnalysis::Partitioner2::ModulesElf::tryLink ( const std::string &  command,
const boost::filesystem::path &  outputName,
std::vector< boost::filesystem::path >  inputNames,
Sawyer::Message::Stream errors,
FixUndefinedSymbols::Boolean  fixUndefinedSymbols = FixUndefinedSymbols::YES 
)

Try to run a link command.

The substring "%o" is replaced by the quoted output name, and the substring "%f" is replaced by the space separated list of quoted input names. Bourne shell escape syntax is used. Returns true if the link command was successful, false otherwise.

std::vector<boost::filesystem::path> Rose::BinaryAnalysis::Partitioner2::ModulesElf::extractStaticArchive ( const boost::filesystem::path &  directory,
const boost::filesystem::path &  archive 
)

Extract object files from a static archive.

Given the name of an archive file, extract the member files and return a list of object files. The files are extracted into a subdirectory of the specified directory. The name of the subdirectory is the same as the file name (not directory part) of the archive.

void Rose::BinaryAnalysis::Partitioner2::ModulesElf::buildMayReturnLists ( Partitioner )

Build may-return white and black lists.