blob: 4fa5c1cfea3fb99fba4acbc6cc85049ea8d7f45d [file] [log] [blame]
Preston Gurd482f8782012-04-16 22:26:48 +00001//===---- 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
19namespace llvm {
20
21class ObjectImage {
Craig Topperc2945e42012-09-18 02:01:41 +000022 ObjectImage() LLVM_DELETED_FUNCTION;
23 ObjectImage(const ObjectImage &other) LLVM_DELETED_FUNCTION;
Preston Gurd482f8782012-04-16 22:26:48 +000024protected:
25 object::ObjectFile *ObjFile;
26
27public:
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
Eli Bendersky5fe01982012-04-29 12:40:47 +000051 // Subclasses can override these methods to provide JIT debugging support
Preston Gurd482f8782012-04-16 22:26:48 +000052 virtual void registerWithDebugger() {}
53 virtual void deregisterWithDebugger() {}
54};
55
56} // end namespace llvm
57
58#endif // LLVM_RUNTIMEDYLD_OBJECT_IMAGE_H
59