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

Description

Disassembly and partitioning utility functions for ELF.

Namespaces

namespace  FixUndefinedSymbols
 Boolean flag for tryLink.
 

Classes

struct  PltEntryMatcher
 Matches an ELF PLT entry. More...
 
struct  PltInfo
 Information about the procedure lookup table. More...
 

Functions

PltInfo findPlt (const PartitionerConstPtr &, SgAsmGenericSection *, SgAsmElfFileHeader *)
 Find information about the PLT.
 
std::vector< SgAsmElfSection * > findSectionsByName (SgAsmInterpretation *, const std::string &)
 Get a list of all ELF sections by name.
 
bool isImport (const PartitionerConstPtr &, const FunctionPtr &)
 True if the function is an import.
 
bool isLinkedImport (const PartitionerConstPtr &, const FunctionPtr &)
 True if function is a linked import.
 
bool isUnlinkedImport (const PartitionerConstPtr &, const FunctionPtr &)
 True if function is a non-linked import.
 
bool isObjectFile (const boost::filesystem::path &)
 True if named file is an ELF object file.
 
bool isStaticArchive (const boost::filesystem::path &)
 True if named file is a static library archive.
 
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.
 
std::vector< boost::filesystem::path > extractStaticArchive (const boost::filesystem::path &directory, const boost::filesystem::path &archive)
 Extract object files from a static archive.
 
void buildMayReturnLists (const PartitionerPtr &)
 Build may-return white and black lists.
 
std::vector< FunctionPtrfindErrorHandlingFunctions (SgAsmElfFileHeader *)
 Reads ELF .eh_frames to find function entry addresses.
 
std::vector< FunctionPtrfindErrorHandlingFunctions (SgAsmInterpretation *)
 Reads ELF .eh_frames to find function entry addresses.
 
size_t findErrorHandlingFunctions (SgAsmElfFileHeader *, std::vector< FunctionPtr > &)
 Reads ELF .eh_frames to find function entry addresses.
 
std::vector< FunctionPtrfindPltFunctions (const PartitionerPtr &, SgAsmElfFileHeader *)
 Reads ELF PLT sections and returns a list of functions.
 
std::vector< FunctionPtrfindPltFunctions (const PartitionerPtr &, SgAsmInterpretation *)
 Reads ELF PLT sections and returns a list of functions.
 
size_t findPltFunctions (const PartitionerPtr &, SgAsmElfFileHeader *, std::vector< FunctionPtr > &)
 Reads ELF PLT sections and returns a list of functions.
 

Function Documentation

◆ findErrorHandlingFunctions() [1/3]

std::vector< FunctionPtr > 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.

◆ findErrorHandlingFunctions() [2/3]

std::vector< FunctionPtr > 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.

◆ findErrorHandlingFunctions() [3/3]

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

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.

◆ findSectionsByName()

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.

◆ isImport()

bool Rose::BinaryAnalysis::Partitioner2::ModulesElf::isImport ( const PartitionerConstPtr ,
const FunctionPtr  
)

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.

◆ isLinkedImport()

bool Rose::BinaryAnalysis::Partitioner2::ModulesElf::isLinkedImport ( const PartitionerConstPtr ,
const FunctionPtr  
)

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.

◆ isUnlinkedImport()

bool Rose::BinaryAnalysis::Partitioner2::ModulesElf::isUnlinkedImport ( const PartitionerConstPtr ,
const FunctionPtr  
)

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.

◆ isObjectFile()

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.

◆ isStaticArchive()

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.

◆ tryLink()

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.

◆ extractStaticArchive()

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.