ROSE  0.11.83.2
BinaryLoaderPe.h
1 #ifndef ROSE_BinaryAnalysis_BinaryLoaderPe_H
2 #define ROSE_BinaryAnalysis_BinaryLoaderPe_H
3 #include <featureTests.h>
4 #ifdef ROSE_ENABLE_BINARY_ANALYSIS
5 #include <Rose/BinaryAnalysis/BinaryLoader.h>
6 
7 namespace Rose {
8 namespace BinaryAnalysis {
9 
12 
15 public:
18 
19 protected:
20  BinaryLoaderPe() {
23  performingRemap(true);
24  }
25 
26  BinaryLoaderPe(const BinaryLoaderPe &other)
27  : BinaryLoader(other){
30  performingRemap(true);
31  }
32 
33 public:
35  static Ptr instance() {
36  return Ptr(new BinaryLoaderPe);
37  }
38 
39  virtual BinaryLoaderPtr clone() const override {
40  return BinaryLoaderPtr(new BinaryLoaderPe(*this));
41  }
42 
43  virtual ~BinaryLoaderPe() {}
44 
45  /* Override virtual methods from BinaryLoader */
46 public:
47 
48  virtual bool canLoad(SgAsmGenericHeader*) const override;
49 
50  // documented in superclass
51  virtual void link(SgAsmInterpretation *interp) override;
52 
54  virtual rose_addr_t rebase(const MemoryMap::Ptr&, SgAsmGenericHeader*, const SgAsmGenericSectionPtrList&) override;
55 
56  // Resolve import section to DLL files.
57  virtual void fixup(SgAsmInterpretation *interp, FixupErrors *errors=NULL) override;
58 
59  // Returns sections in order of their definition in the PE Section Table.
60  virtual SgAsmGenericSectionPtrList getRemapSections(SgAsmGenericHeader*) override;
61 
63  virtual MappingContribution alignValues(SgAsmGenericSection*, const MemoryMap::Ptr&,
64  rose_addr_t *malign_lo, rose_addr_t *malign_hi,
65  rose_addr_t *va, rose_addr_t *mem_size,
66  rose_addr_t *offset, rose_addr_t *file_size, bool *map_private,
67  rose_addr_t *va_offset, bool *anon_lo, bool *anon_hi,
68  ConflictResolution *resolve) override;
69 
73  virtual bool isLinked(SgBinaryComposite *composite, const std::string &filename) override;
74  virtual bool isLinked(SgAsmInterpretation *interp, const std::string &filename) override;
79  void addLibDefaults(SgAsmGenericHeader *header=NULL);
80 
85  virtual std::string findSoFile(const std::string &libname) const override;
86 
87 };
88 
89 } // namespace
90 } // namespace
91 
92 #endif
93 #endif
bool performingRelocations() const
Property: Whether this loader will perform the relocation step.
Definition: BinaryLoader.h:218
bool performingRemap() const
Property: Whether this loader will perform the mapping step.
Definition: BinaryLoader.h:206
Contiguous region of a file.
virtual SgAsmGenericSectionPtrList getRemapSections(SgAsmGenericHeader *) override
Selects those sections of a header that should be mapped.
Loader for Windows PE files.
virtual void fixup(SgAsmInterpretation *interp, FixupErrors *errors=NULL) override
Performs relocation fixups on the specified interpretation.
Sawyer::SharedPointer< class BinaryLoaderPe > BinaryLoaderPePtr
Reference counting pointer to BinaryLoaderPe.
Main namespace for the ROSE library.
virtual void link(SgAsmInterpretation *interp) override
Finds and parses all shared objects needed by an interpretation.
Reference-counting intrusive smart pointer.
Definition: SharedPointer.h:68
void addLibDefaults(SgAsmGenericHeader *header=NULL)
Sets up library search paths and preloads from the environment.
Base class for container file headers.
virtual std::string findSoFile(const std::string &libname) const override
Convert name to fully qualified name.
static Ptr instance()
Allocating constructor.
virtual MappingContribution alignValues(SgAsmGenericSection *, const MemoryMap::Ptr &, 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) override
Windows-specific PE section alignment.
virtual BinaryLoaderPtr clone() const override
Creates a new copy of a loader.
Sawyer::SharedPointer< class BinaryLoader > BinaryLoaderPtr
Reference counting pointer to BinaryLoader.
Definition: BinaryLoader.h:15
MappingContribution
Describes how a section contributes to the overall memory map.
Definition: BinaryLoader.h:65
virtual bool isLinked(SgBinaryComposite *composite, const std::string &filename) override
Returns true if the specified file name is already linked into the AST.
virtual bool canLoad(SgAsmGenericHeader *) const override
Predicate determining the suitability of a loader for a specific file header.
ConflictResolution
Describes how conflicts are resolved when mapping a section.
Definition: BinaryLoader.h:73
Base class for loading a static or dynamic object.
Definition: BinaryLoader.h:56
bool performingDynamicLinking() const
Property: Whether this loader will perform the linking step.
Definition: BinaryLoader.h:195
Represents an interpretation of a binary container.
Sawyer::SharedPointer< BinaryLoaderPe > Ptr
Reference counting pointer to BinaryLoaderPe.
virtual rose_addr_t rebase(const MemoryMap::Ptr &, SgAsmGenericHeader *, const SgAsmGenericSectionPtrList &) override
Returns a new, temporary base address which is greater than everything that's been mapped already...