4fa5c1cfea3fb99fba4acbc6cc85049ea8d7f45d
[oota-llvm.git] / lib / ExecutionEngine / RuntimeDyld / ObjectImage.h
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() LLVM_DELETED_FUNCTION;
23   ObjectImage(const ObjectImage &other) LLVM_DELETED_FUNCTION;
24 protected:
25   object::ObjectFile *ObjFile;
26
27 public:
28   ObjectImage(object::ObjectFile *Obj) { ObjFile = Obj; }
29   virtual ~ObjectImage() {}
30
31   virtual object::symbol_iterator begin_symbols() const
32               { return ObjFile->begin_symbols(); }
33   virtual object::symbol_iterator end_symbols() const
34               { return ObjFile->end_symbols(); }
35
36   virtual object::section_iterator begin_sections() const
37               { return ObjFile->begin_sections(); }
38   virtual object::section_iterator end_sections() const
39               { return ObjFile->end_sections(); }
40
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
46   virtual void updateSectionAddress(const object::SectionRef &Sec,
47                                     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
52   virtual void registerWithDebugger() {}
53   virtual void deregisterWithDebugger() {}
54 };
55
56 } // end namespace llvm
57
58 #endif // LLVM_RUNTIMEDYLD_OBJECT_IMAGE_H
59