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: |
| 25 | void resolveX86_64Relocation(uint8_t *LocalAddress, |
| 26 | uint64_t FinalAddress, |
| 27 | uint64_t Value, |
| 28 | uint32_t Type, |
| 29 | int64_t Addend); |
Eli Bendersky | 76463fd | 2012-01-22 07:05:02 +0000 | [diff] [blame] | 30 | |
Danil Malyshev | 0e4fa5f | 2012-03-30 16:45:19 +0000 | [diff] [blame] | 31 | void resolveX86Relocation(uint8_t *LocalAddress, |
| 32 | uint32_t FinalAddress, |
| 33 | uint32_t Value, |
| 34 | uint32_t Type, |
| 35 | int32_t Addend); |
Eli Bendersky | 76463fd | 2012-01-22 07:05:02 +0000 | [diff] [blame] | 36 | |
Danil Malyshev | 0e4fa5f | 2012-03-30 16:45:19 +0000 | [diff] [blame] | 37 | void resolveARMRelocation(uint8_t *LocalAddress, |
| 38 | uint32_t FinalAddress, |
| 39 | uint32_t Value, |
| 40 | uint32_t Type, |
| 41 | int32_t Addend); |
Eli Bendersky | 76463fd | 2012-01-22 07:05:02 +0000 | [diff] [blame] | 42 | |
Akira Hatanaka | b889e0c | 2012-08-17 21:28:04 +0000 | [diff] [blame] | 43 | void resolveMIPSRelocation(uint8_t *LocalAddress, |
Akira Hatanaka | b862f09 | 2012-08-20 17:53:24 +0000 | [diff] [blame] | 44 | uint32_t FinalAddress, |
| 45 | uint32_t Value, |
| 46 | uint32_t Type, |
| 47 | int32_t Addend); |
Akira Hatanaka | b889e0c | 2012-08-17 21:28:04 +0000 | [diff] [blame] | 48 | |
Danil Malyshev | 0e4fa5f | 2012-03-30 16:45:19 +0000 | [diff] [blame] | 49 | virtual void resolveRelocation(uint8_t *LocalAddress, |
| 50 | uint64_t FinalAddress, |
| 51 | uint64_t Value, |
| 52 | uint32_t Type, |
| 53 | int64_t Addend); |
Eli Bendersky | 76463fd | 2012-01-22 07:05:02 +0000 | [diff] [blame] | 54 | |
Danil Malyshev | 0e4fa5f | 2012-03-30 16:45:19 +0000 | [diff] [blame] | 55 | virtual void processRelocationRef(const ObjRelocationInfo &Rel, |
Preston Gurd | 689ff9c | 2012-04-16 22:12:58 +0000 | [diff] [blame] | 56 | ObjectImage &Obj, |
Danil Malyshev | 0e4fa5f | 2012-03-30 16:45:19 +0000 | [diff] [blame] | 57 | ObjSectionToIDMap &ObjSectionToID, |
Eli Bendersky | d98c9e9 | 2012-05-01 06:58:59 +0000 | [diff] [blame] | 58 | const SymbolTableMap &Symbols, |
| 59 | StubMap &Stubs); |
Eli Bendersky | 76463fd | 2012-01-22 07:05:02 +0000 | [diff] [blame] | 60 | |
Andrew Kaylor | 3f23cef | 2012-10-02 21:18:39 +0000 | [diff] [blame] | 61 | virtual ObjectImage *createObjectImage(ObjectBuffer *InputBuffer); |
Preston Gurd | 689ff9c | 2012-04-16 22:12:58 +0000 | [diff] [blame] | 62 | |
Eli Bendersky | 76463fd | 2012-01-22 07:05:02 +0000 | [diff] [blame] | 63 | public: |
Preston Gurd | 689ff9c | 2012-04-16 22:12:58 +0000 | [diff] [blame] | 64 | RuntimeDyldELF(RTDyldMemoryManager *mm) |
Andrew Kaylor | 3f23cef | 2012-10-02 21:18:39 +0000 | [diff] [blame] | 65 | : RuntimeDyldImpl(mm) {} |
Preston Gurd | 689ff9c | 2012-04-16 22:12:58 +0000 | [diff] [blame] | 66 | |
| 67 | virtual ~RuntimeDyldELF(); |
Eli Bendersky | 76463fd | 2012-01-22 07:05:02 +0000 | [diff] [blame] | 68 | |
Andrew Kaylor | 3f23cef | 2012-10-02 21:18:39 +0000 | [diff] [blame] | 69 | bool isCompatibleFormat(const ObjectBuffer *Buffer) const; |
Eli Bendersky | 76463fd | 2012-01-22 07:05:02 +0000 | [diff] [blame] | 70 | }; |
| 71 | |
| 72 | } // end namespace llvm |
| 73 | |
Danil Malyshev | 0e4fa5f | 2012-03-30 16:45:19 +0000 | [diff] [blame] | 74 | #endif |