Eli Bendersky | 058d647 | 2012-01-22 07:05:02 +0000 | [diff] [blame] | 1 | //===-- RuntimeDyldMachO.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 | // MachO support for MC-JIT runtime dynamic linker. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #ifndef LLVM_RUNTIME_DYLD_MACHO_H |
| 15 | #define LLVM_RUNTIME_DYLD_MACHO_H |
| 16 | |
Chandler Carruth | 802d755 | 2012-12-04 07:12:27 +0000 | [diff] [blame] | 17 | #include "RuntimeDyldImpl.h" |
Eli Bendersky | 058d647 | 2012-01-22 07:05:02 +0000 | [diff] [blame] | 18 | #include "llvm/ADT/IndexedMap.h" |
Rafael Espindola | 6e040c0 | 2013-04-26 20:07:33 +0000 | [diff] [blame] | 19 | #include "llvm/Object/MachO.h" |
Eli Bendersky | 058d647 | 2012-01-22 07:05:02 +0000 | [diff] [blame] | 20 | #include "llvm/Support/Format.h" |
Eli Bendersky | 058d647 | 2012-01-22 07:05:02 +0000 | [diff] [blame] | 21 | |
| 22 | using namespace llvm; |
| 23 | using namespace llvm::object; |
| 24 | |
| 25 | |
| 26 | namespace llvm { |
| 27 | class RuntimeDyldMachO : public RuntimeDyldImpl { |
Danil Malyshev | 70d22cc | 2012-03-30 16:45:19 +0000 | [diff] [blame] | 28 | protected: |
Sean Callanan | a375943 | 2012-03-26 20:45:52 +0000 | [diff] [blame] | 29 | bool resolveI386Relocation(uint8_t *LocalAddress, |
| 30 | uint64_t FinalAddress, |
| 31 | uint64_t Value, |
| 32 | bool isPCRel, |
| 33 | unsigned Type, |
| 34 | unsigned Size, |
| 35 | int64_t Addend); |
Sean Callanan | ca92a3d | 2012-03-07 23:05:25 +0000 | [diff] [blame] | 36 | bool resolveX86_64Relocation(uint8_t *LocalAddress, |
| 37 | uint64_t FinalAddress, |
| 38 | uint64_t Value, |
| 39 | bool isPCRel, |
| 40 | unsigned Type, |
| 41 | unsigned Size, |
| 42 | int64_t Addend); |
| 43 | bool resolveARMRelocation(uint8_t *LocalAddress, |
| 44 | uint64_t FinalAddress, |
| 45 | uint64_t Value, |
| 46 | bool isPCRel, |
| 47 | unsigned Type, |
| 48 | unsigned Size, |
| 49 | int64_t Addend); |
Eli Bendersky | 058d647 | 2012-01-22 07:05:02 +0000 | [diff] [blame] | 50 | |
Rafael Espindola | 4d4a48d | 2013-04-29 14:44:23 +0000 | [diff] [blame] | 51 | virtual void processRelocationRef(unsigned SectionID, |
| 52 | relocation_iterator RelI, |
Preston Gurd | cc31af9 | 2012-04-16 22:12:58 +0000 | [diff] [blame] | 53 | ObjectImage &Obj, |
Danil Malyshev | 70d22cc | 2012-03-30 16:45:19 +0000 | [diff] [blame] | 54 | ObjSectionToIDMap &ObjSectionToID, |
Eli Bendersky | fc07908 | 2012-05-01 06:58:59 +0000 | [diff] [blame] | 55 | const SymbolTableMap &Symbols, |
| 56 | StubMap &Stubs); |
Eli Bendersky | 058d647 | 2012-01-22 07:05:02 +0000 | [diff] [blame] | 57 | |
| 58 | public: |
Andrew Kaylor | fb05a50 | 2012-11-02 19:45:23 +0000 | [diff] [blame] | 59 | virtual void resolveRelocation(const SectionEntry &Section, |
| 60 | uint64_t Offset, |
Danil Malyshev | 70d22cc | 2012-03-30 16:45:19 +0000 | [diff] [blame] | 61 | uint64_t Value, |
| 62 | uint32_t Type, |
| 63 | int64_t Addend); |
Preston Gurd | cc31af9 | 2012-04-16 22:12:58 +0000 | [diff] [blame] | 64 | |
Eli Bendersky | 058d647 | 2012-01-22 07:05:02 +0000 | [diff] [blame] | 65 | RuntimeDyldMachO(RTDyldMemoryManager *mm) : RuntimeDyldImpl(mm) {} |
| 66 | |
Andrew Kaylor | adc7056 | 2012-10-02 21:18:39 +0000 | [diff] [blame] | 67 | bool isCompatibleFormat(const ObjectBuffer *Buffer) const; |
Eli Bendersky | 058d647 | 2012-01-22 07:05:02 +0000 | [diff] [blame] | 68 | }; |
| 69 | |
| 70 | } // end namespace llvm |
| 71 | |
| 72 | #endif |