Eli Bendersky | 76463fd | 2012-01-22 07:05:02 +0000 | [diff] [blame] | 1 | //===-- RuntimeDyldELF.h - Run-time dynamic linker for MC-JIT ---*- C++ -*-===// |
| 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 | // ELF support for MC-JIT runtime dynamic linker. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #ifndef LLVM_RUNTIME_DYLD_ELF_H |
| 15 | #define LLVM_RUNTIME_DYLD_ELF_H |
| 16 | |
| 17 | #include "RuntimeDyldImpl.h" |
| 18 | |
| 19 | using namespace llvm; |
| 20 | |
| 21 | |
| 22 | namespace llvm { |
| 23 | class RuntimeDyldELF : public RuntimeDyldImpl { |
Danil Malyshev | 0e4fa5f | 2012-03-30 16:45:19 +0000 | [diff] [blame] | 24 | protected: |
Preston Gurd | 689ff9c | 2012-04-16 22:12:58 +0000 | [diff] [blame] | 25 | ObjectImage *LoadedObject; |
| 26 | |
Danil Malyshev | 0e4fa5f | 2012-03-30 16:45:19 +0000 | [diff] [blame] | 27 | void resolveX86_64Relocation(uint8_t *LocalAddress, |
| 28 | uint64_t FinalAddress, |
| 29 | uint64_t Value, |
| 30 | uint32_t Type, |
| 31 | int64_t Addend); |
Eli Bendersky | 76463fd | 2012-01-22 07:05:02 +0000 | [diff] [blame] | 32 | |
Danil Malyshev | 0e4fa5f | 2012-03-30 16:45:19 +0000 | [diff] [blame] | 33 | void resolveX86Relocation(uint8_t *LocalAddress, |
| 34 | uint32_t FinalAddress, |
| 35 | uint32_t Value, |
| 36 | uint32_t Type, |
| 37 | int32_t Addend); |
Eli Bendersky | 76463fd | 2012-01-22 07:05:02 +0000 | [diff] [blame] | 38 | |
Danil Malyshev | 0e4fa5f | 2012-03-30 16:45:19 +0000 | [diff] [blame] | 39 | void resolveARMRelocation(uint8_t *LocalAddress, |
| 40 | uint32_t FinalAddress, |
| 41 | uint32_t Value, |
| 42 | uint32_t Type, |
| 43 | int32_t Addend); |
Eli Bendersky | 76463fd | 2012-01-22 07:05:02 +0000 | [diff] [blame] | 44 | |
Akira Hatanaka | b889e0c | 2012-08-17 21:28:04 +0000 | [diff] [blame^] | 45 | void resolveMIPSRelocation(uint8_t *LocalAddress, |
| 46 | uint32_t FinalAddress, |
| 47 | uint32_t Value, |
| 48 | uint32_t Type, |
| 49 | int32_t Addend); |
| 50 | |
Danil Malyshev | 0e4fa5f | 2012-03-30 16:45:19 +0000 | [diff] [blame] | 51 | virtual void resolveRelocation(uint8_t *LocalAddress, |
| 52 | uint64_t FinalAddress, |
| 53 | uint64_t Value, |
| 54 | uint32_t Type, |
| 55 | int64_t Addend); |
Eli Bendersky | 76463fd | 2012-01-22 07:05:02 +0000 | [diff] [blame] | 56 | |
Danil Malyshev | 0e4fa5f | 2012-03-30 16:45:19 +0000 | [diff] [blame] | 57 | virtual void processRelocationRef(const ObjRelocationInfo &Rel, |
Preston Gurd | 689ff9c | 2012-04-16 22:12:58 +0000 | [diff] [blame] | 58 | ObjectImage &Obj, |
Danil Malyshev | 0e4fa5f | 2012-03-30 16:45:19 +0000 | [diff] [blame] | 59 | ObjSectionToIDMap &ObjSectionToID, |
Eli Bendersky | d98c9e9 | 2012-05-01 06:58:59 +0000 | [diff] [blame] | 60 | const SymbolTableMap &Symbols, |
| 61 | StubMap &Stubs); |
Eli Bendersky | 76463fd | 2012-01-22 07:05:02 +0000 | [diff] [blame] | 62 | |
Preston Gurd | 689ff9c | 2012-04-16 22:12:58 +0000 | [diff] [blame] | 63 | virtual ObjectImage *createObjectImage(const MemoryBuffer *InputBuffer); |
| 64 | virtual void handleObjectLoaded(ObjectImage *Obj); |
| 65 | |
Eli Bendersky | 76463fd | 2012-01-22 07:05:02 +0000 | [diff] [blame] | 66 | public: |
Preston Gurd | 689ff9c | 2012-04-16 22:12:58 +0000 | [diff] [blame] | 67 | RuntimeDyldELF(RTDyldMemoryManager *mm) |
| 68 | : RuntimeDyldImpl(mm), LoadedObject(0) {} |
| 69 | |
| 70 | virtual ~RuntimeDyldELF(); |
Eli Bendersky | 76463fd | 2012-01-22 07:05:02 +0000 | [diff] [blame] | 71 | |
Eli Bendersky | 76463fd | 2012-01-22 07:05:02 +0000 | [diff] [blame] | 72 | bool isCompatibleFormat(const MemoryBuffer *InputBuffer) const; |
| 73 | }; |
| 74 | |
| 75 | } // end namespace llvm |
| 76 | |
Danil Malyshev | 0e4fa5f | 2012-03-30 16:45:19 +0000 | [diff] [blame] | 77 | #endif |