1#ifndef ROSE_BinaryAnalysis_Partitioner2_ModulesElf_H
2#define ROSE_BinaryAnalysis_Partitioner2_ModulesElf_H
3#include <featureTests.h>
4#ifdef ROSE_ENABLE_BINARY_ANALYSIS
6#include <Rose/BinaryAnalysis/Partitioner2/BasicTypes.h>
7#include <Rose/BinaryAnalysis/Partitioner2/Function.h>
8#include <Rose/BinaryAnalysis/Partitioner2/Modules.h>
10#include <boost/filesystem.hpp>
13namespace BinaryAnalysis {
14namespace Partitioner2 {
86namespace FixUndefinedSymbols {
86namespace FixUndefinedSymbols {
…}
98bool tryLink(
const std::string &command,
const boost::filesystem::path &outputName,
107std::vector<boost::filesystem::path>
116 size_t gotEntryNBytes_ = 0;
118 size_t nBytesMatched_ = 0;
120 Address pltEntryAlignment_ = 1;
153 size_t &indirectNBytes );
155 size_t &indirectNBytes );
17namespace ModulesElf {
…}
Base class for matching an instruction pattern.
Sawyer::SharedPointer< InstructionMatcher > Ptr
Shared-ownership pointer to an InstructionMatcher.
Converts text to messages.
Reference-counting intrusive smart pointer.
Contiguous region of a file.
Base class for machine instructions.
Represents an interpretation of a binary container.
Boolean
Boolean flag for Rose::BinaryAnalysis::Partitioner2::ModulesElf::tryLink.
@ YES
Yes, try to fix undefined symbols.
@ NO
Do not try to fix undefined symbols.
bool isImport(const PartitionerConstPtr &, const FunctionPtr &)
True if the function is an import.
std::vector< FunctionPtr > findErrorHandlingFunctions(SgAsmElfFileHeader *)
Reads ELF .eh_frames to find function entry addresses.
std::vector< SgAsmElfSection * > findSectionsByName(SgAsmInterpretation *, const std::string &)
Get a list of all ELF sections by name.
bool isObjectFile(const boost::filesystem::path &)
True if named file is an ELF object file.
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.
PltInfo findPlt(const PartitionerConstPtr &, SgAsmGenericSection *, SgAsmElfFileHeader *)
Find information about the PLT.
std::vector< FunctionPtr > findPltFunctions(const PartitionerPtr &, SgAsmElfFileHeader *)
Reads ELF PLT sections and returns a list of functions.
bool isLinkedImport(const PartitionerConstPtr &, const FunctionPtr &)
True if function is a linked import.
void buildMayReturnLists(const PartitionerPtr &)
Build may-return white and black lists.
std::vector< boost::filesystem::path > extractStaticArchive(const boost::filesystem::path &directory, const boost::filesystem::path &archive)
Extract object files from a static archive.
bool isStaticArchive(const boost::filesystem::path &)
True if named file is a static library archive.
bool isUnlinkedImport(const PartitionerConstPtr &, const FunctionPtr &)
True if function is a non-linked import.
std::uint64_t Address
Address.
Matches an ELF PLT entry.
Address gotEntry() const
Value stored in the GOT entry.
size_t nBytesMatched() const
Size of the PLT entry in bytes.
Address gotVa() const
Address of global offset table.
size_t gotEntryNBytes() const
Size of the GOT entry in bytes.
virtual bool match(const PartitionerConstPtr &, Address anchor)
Attempt to match an instruction pattern.
Address gotEntryVa() const
Address of the corresponding GOT entry.
Address pltEntryAlignment() const
Alignment of PLT entries w.r.t.
Information about the procedure lookup table.
size_t entrySize
Size of each entry in bytes.
size_t firstOffset
Byte offset w.r.t.