• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===---- ObjectImage.h - Format independent executuable object image -----===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file declares a file format independent ObjectImage class.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_RUNTIMEDYLD_OBJECT_IMAGE_H
15 #define LLVM_RUNTIMEDYLD_OBJECT_IMAGE_H
16 
17 #include "llvm/Object/ObjectFile.h"
18 
19 namespace llvm {
20 
21 class ObjectImage {
22   ObjectImage(); // = delete
23   ObjectImage(const ObjectImage &other); // = delete
24 protected:
25   object::ObjectFile *ObjFile;
26 
27 public:
ObjectImage(object::ObjectFile * Obj)28   ObjectImage(object::ObjectFile *Obj) { ObjFile = Obj; }
~ObjectImage()29   virtual ~ObjectImage() {}
30 
begin_symbols()31   virtual object::symbol_iterator begin_symbols() const
32               { return ObjFile->begin_symbols(); }
end_symbols()33   virtual object::symbol_iterator end_symbols() const
34               { return ObjFile->end_symbols(); }
35 
begin_sections()36   virtual object::section_iterator begin_sections() const
37               { return ObjFile->begin_sections(); }
end_sections()38   virtual object::section_iterator end_sections() const
39               { return ObjFile->end_sections(); }
40 
getArch()41   virtual /* Triple::ArchType */ unsigned getArch() const
42               { return ObjFile->getArch(); }
43 
44   // Subclasses can override these methods to update the image with loaded
45   // addresses for sections and common symbols
updateSectionAddress(const object::SectionRef & Sec,uint64_t Addr)46   virtual void updateSectionAddress(const object::SectionRef &Sec,
47                                     uint64_t Addr) {}
updateSymbolAddress(const object::SymbolRef & Sym,uint64_t Addr)48   virtual void updateSymbolAddress(const object::SymbolRef &Sym, uint64_t Addr)
49               {}
50 
51   // Subclasses can override these methods to provide JIT debugging support
registerWithDebugger()52   virtual void registerWithDebugger() {}
deregisterWithDebugger()53   virtual void deregisterWithDebugger() {}
54 };
55 
56 } // end namespace llvm
57 
58 #endif // LLVM_RUNTIMEDYLD_OBJECT_IMAGE_H
59 
60