Jim Grosbach | 06594e1 | 2012-01-16 23:50:58 +0000 | [diff] [blame] | 1 | //===-- RuntimeDyldImpl.h - Run-time dynamic linker for MC-JIT --*- C++ -*-===// |
Danil Malyshev | 72510f2 | 2011-07-13 07:57:58 +0000 | [diff] [blame] | 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 | // Interface for the implementations of runtime dynamic linker facilities. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
Benjamin Kramer | a7c40ef | 2014-08-13 16:26:38 +0000 | [diff] [blame] | 14 | #ifndef LLVM_LIB_EXECUTIONENGINE_RUNTIMEDYLD_RUNTIMEDYLDIMPL_H |
| 15 | #define LLVM_LIB_EXECUTIONENGINE_RUNTIMEDYLD_RUNTIMEDYLDIMPL_H |
Danil Malyshev | 72510f2 | 2011-07-13 07:57:58 +0000 | [diff] [blame] | 16 | |
Danil Malyshev | 72510f2 | 2011-07-13 07:57:58 +0000 | [diff] [blame] | 17 | #include "llvm/ADT/SmallVector.h" |
Eli Bendersky | 32d5488 | 2012-04-30 10:06:27 +0000 | [diff] [blame] | 18 | #include "llvm/ADT/StringMap.h" |
| 19 | #include "llvm/ADT/Triple.h" |
Lang Hames | 633fe14 | 2015-03-30 03:37:06 +0000 | [diff] [blame] | 20 | #include "llvm/ExecutionEngine/RTDyldMemoryManager.h" |
Chandler Carruth | 802d755 | 2012-12-04 07:12:27 +0000 | [diff] [blame] | 21 | #include "llvm/ExecutionEngine/RuntimeDyld.h" |
Lang Hames | e1c1138 | 2014-06-27 20:20:57 +0000 | [diff] [blame] | 22 | #include "llvm/ExecutionEngine/RuntimeDyldChecker.h" |
Eli Bendersky | 32d5488 | 2012-04-30 10:06:27 +0000 | [diff] [blame] | 23 | #include "llvm/Object/ObjectFile.h" |
Danil Malyshev | 72510f2 | 2011-07-13 07:57:58 +0000 | [diff] [blame] | 24 | #include "llvm/Support/Debug.h" |
| 25 | #include "llvm/Support/ErrorHandling.h" |
Danil Malyshev | 70d22cc | 2012-03-30 16:45:19 +0000 | [diff] [blame] | 26 | #include "llvm/Support/Format.h" |
Adhemerval Zanella | 5fc11b3 | 2012-10-25 13:13:48 +0000 | [diff] [blame] | 27 | #include "llvm/Support/Host.h" |
Andrew Kaylor | 4fba049 | 2013-10-21 17:42:06 +0000 | [diff] [blame] | 28 | #include "llvm/Support/Mutex.h" |
Adhemerval Zanella | 5fc11b3 | 2012-10-25 13:13:48 +0000 | [diff] [blame] | 29 | #include "llvm/Support/SwapByteOrder.h" |
Eli Bendersky | 32d5488 | 2012-04-30 10:06:27 +0000 | [diff] [blame] | 30 | #include <map> |
Keno Fischer | eb59d46 | 2015-12-03 21:27:59 +0000 | [diff] [blame] | 31 | #include <unordered_map> |
Rafael Espindola | a6e9c3e | 2014-06-12 17:38:55 +0000 | [diff] [blame] | 32 | #include <system_error> |
Danil Malyshev | 72510f2 | 2011-07-13 07:57:58 +0000 | [diff] [blame] | 33 | |
| 34 | using namespace llvm; |
Danil Malyshev | 70d22cc | 2012-03-30 16:45:19 +0000 | [diff] [blame] | 35 | using namespace llvm::object; |
Danil Malyshev | 72510f2 | 2011-07-13 07:57:58 +0000 | [diff] [blame] | 36 | |
| 37 | namespace llvm { |
Danil Malyshev | 70d22cc | 2012-03-30 16:45:19 +0000 | [diff] [blame] | 38 | |
Eli Bendersky | 32d5488 | 2012-04-30 10:06:27 +0000 | [diff] [blame] | 39 | class Twine; |
| 40 | |
Lang Hames | 8959531 | 2016-04-27 20:24:48 +0000 | [diff] [blame] | 41 | #define UNIMPLEMENTED_RELOC(RelType) \ |
| 42 | case RelType: \ |
| 43 | return make_error<RuntimeDyldError>("Unimplemented relocation: " #RelType) |
| 44 | |
Eli Bendersky | 32d5488 | 2012-04-30 10:06:27 +0000 | [diff] [blame] | 45 | /// SectionEntry - represents a section emitted into memory by the dynamic |
| 46 | /// linker. |
Danil Malyshev | 70d22cc | 2012-03-30 16:45:19 +0000 | [diff] [blame] | 47 | class SectionEntry { |
Adhemerval Zanella | 5fc11b3 | 2012-10-25 13:13:48 +0000 | [diff] [blame] | 48 | /// Name - section name. |
Lang Hames | ccc588e | 2015-04-14 17:13:10 +0000 | [diff] [blame] | 49 | std::string Name; |
Adhemerval Zanella | 5fc11b3 | 2012-10-25 13:13:48 +0000 | [diff] [blame] | 50 | |
Eli Bendersky | 32d5488 | 2012-04-30 10:06:27 +0000 | [diff] [blame] | 51 | /// Address - address in the linker's memory where the section resides. |
| 52 | uint8_t *Address; |
| 53 | |
Rafael Espindola | fa5942b | 2013-05-05 20:43:10 +0000 | [diff] [blame] | 54 | /// Size - section size. Doesn't include the stubs. |
Eli Bendersky | 32d5488 | 2012-04-30 10:06:27 +0000 | [diff] [blame] | 55 | size_t Size; |
| 56 | |
| 57 | /// LoadAddress - the address of the section in the target process's memory. |
| 58 | /// Used for situations in which JIT-ed code is being executed in the address |
| 59 | /// space of a separate process. If the code executes in the same address |
| 60 | /// space where it was JIT-ed, this just equals Address. |
| 61 | uint64_t LoadAddress; |
| 62 | |
| 63 | /// StubOffset - used for architectures with stub functions for far |
| 64 | /// relocations (like ARM). |
| 65 | uintptr_t StubOffset; |
| 66 | |
Sanjoy Das | 8082592 | 2015-11-23 21:47:46 +0000 | [diff] [blame] | 67 | /// The total amount of space allocated for this section. This includes the |
| 68 | /// section size and the maximum amount of space that the stubs can occupy. |
| 69 | size_t AllocationSize; |
| 70 | |
Eli Bendersky | 32d5488 | 2012-04-30 10:06:27 +0000 | [diff] [blame] | 71 | /// ObjAddress - address of the section in the in-memory object file. Used |
| 72 | /// for calculating relocations in some object formats (like MachO). |
| 73 | uintptr_t ObjAddress; |
| 74 | |
Sanjoy Das | 277776a | 2015-11-23 21:47:41 +0000 | [diff] [blame] | 75 | public: |
Adhemerval Zanella | 5fc11b3 | 2012-10-25 13:13:48 +0000 | [diff] [blame] | 76 | SectionEntry(StringRef name, uint8_t *address, size_t size, |
Sanjoy Das | 8082592 | 2015-11-23 21:47:46 +0000 | [diff] [blame] | 77 | size_t allocationSize, uintptr_t objAddress) |
Juergen Ributzka | 7608dc0 | 2014-03-21 20:28:42 +0000 | [diff] [blame] | 78 | : Name(name), Address(address), Size(size), |
Lang Hames | 0717c3de | 2014-08-27 17:48:07 +0000 | [diff] [blame] | 79 | LoadAddress(reinterpret_cast<uintptr_t>(address)), StubOffset(size), |
Sanjoy Das | 5abfbb9 | 2015-11-23 22:59:36 +0000 | [diff] [blame] | 80 | AllocationSize(allocationSize), ObjAddress(objAddress) { |
| 81 | // AllocationSize is used only in asserts, prevent an "unused private field" |
| 82 | // warning: |
| 83 | (void)AllocationSize; |
| 84 | } |
Sanjoy Das | 277776a | 2015-11-23 21:47:41 +0000 | [diff] [blame] | 85 | |
| 86 | StringRef getName() const { return Name; } |
| 87 | |
| 88 | uint8_t *getAddress() const { return Address; } |
| 89 | |
| 90 | /// \brief Return the address of this section with an offset. |
| 91 | uint8_t *getAddressWithOffset(unsigned OffsetBytes) const { |
Sanjoy Das | 8082592 | 2015-11-23 21:47:46 +0000 | [diff] [blame] | 92 | assert(OffsetBytes <= AllocationSize && "Offset out of bounds!"); |
Sanjoy Das | 277776a | 2015-11-23 21:47:41 +0000 | [diff] [blame] | 93 | return Address + OffsetBytes; |
| 94 | } |
| 95 | |
| 96 | size_t getSize() const { return Size; } |
| 97 | |
| 98 | uint64_t getLoadAddress() const { return LoadAddress; } |
| 99 | void setLoadAddress(uint64_t LA) { LoadAddress = LA; } |
| 100 | |
| 101 | /// \brief Return the load address of this section with an offset. |
| 102 | uint64_t getLoadAddressWithOffset(unsigned OffsetBytes) const { |
Sanjoy Das | 8082592 | 2015-11-23 21:47:46 +0000 | [diff] [blame] | 103 | assert(OffsetBytes <= AllocationSize && "Offset out of bounds!"); |
Sanjoy Das | 277776a | 2015-11-23 21:47:41 +0000 | [diff] [blame] | 104 | return LoadAddress + OffsetBytes; |
| 105 | } |
| 106 | |
| 107 | uintptr_t getStubOffset() const { return StubOffset; } |
| 108 | |
Sanjoy Das | 8082592 | 2015-11-23 21:47:46 +0000 | [diff] [blame] | 109 | void advanceStubOffset(unsigned StubSize) { |
| 110 | StubOffset += StubSize; |
| 111 | assert(StubOffset <= AllocationSize && "Not enough space allocated!"); |
| 112 | } |
Sanjoy Das | 277776a | 2015-11-23 21:47:41 +0000 | [diff] [blame] | 113 | |
| 114 | uintptr_t getObjAddress() const { return ObjAddress; } |
Danil Malyshev | 70d22cc | 2012-03-30 16:45:19 +0000 | [diff] [blame] | 115 | }; |
| 116 | |
Eli Bendersky | 32d5488 | 2012-04-30 10:06:27 +0000 | [diff] [blame] | 117 | /// RelocationEntry - used to represent relocations internally in the dynamic |
| 118 | /// linker. |
Danil Malyshev | 70d22cc | 2012-03-30 16:45:19 +0000 | [diff] [blame] | 119 | class RelocationEntry { |
| 120 | public: |
Eli Bendersky | 32d5488 | 2012-04-30 10:06:27 +0000 | [diff] [blame] | 121 | /// SectionID - the section this relocation points to. |
| 122 | unsigned SectionID; |
| 123 | |
| 124 | /// Offset - offset into the section. |
Andrew Kaylor | 4612fed | 2013-08-19 23:27:43 +0000 | [diff] [blame] | 125 | uint64_t Offset; |
Eli Bendersky | 32d5488 | 2012-04-30 10:06:27 +0000 | [diff] [blame] | 126 | |
| 127 | /// RelType - relocation type. |
| 128 | uint32_t RelType; |
| 129 | |
| 130 | /// Addend - the relocation addend encoded in the instruction itself. Also |
| 131 | /// used to make a relocation section relative instead of symbol relative. |
Andrew Kaylor | 4612fed | 2013-08-19 23:27:43 +0000 | [diff] [blame] | 132 | int64_t Addend; |
| 133 | |
Lang Hames | 36072da | 2014-05-12 21:39:59 +0000 | [diff] [blame] | 134 | struct SectionPair { |
| 135 | uint32_t SectionA; |
| 136 | uint32_t SectionB; |
| 137 | }; |
| 138 | |
Andrew Kaylor | 4612fed | 2013-08-19 23:27:43 +0000 | [diff] [blame] | 139 | /// SymOffset - Section offset of the relocation entry's symbol (used for GOT |
| 140 | /// lookup). |
Lang Hames | 36072da | 2014-05-12 21:39:59 +0000 | [diff] [blame] | 141 | union { |
| 142 | uint64_t SymOffset; |
| 143 | SectionPair Sections; |
| 144 | }; |
Eli Bendersky | 32d5488 | 2012-04-30 10:06:27 +0000 | [diff] [blame] | 145 | |
Rafael Espindola | f1f1c62 | 2013-04-29 17:24:34 +0000 | [diff] [blame] | 146 | /// True if this is a PCRel relocation (MachO specific). |
| 147 | bool IsPCRel; |
| 148 | |
| 149 | /// The size of this relocation (MachO specific). |
| 150 | unsigned Size; |
| 151 | |
Eli Bendersky | 32d5488 | 2012-04-30 10:06:27 +0000 | [diff] [blame] | 152 | RelocationEntry(unsigned id, uint64_t offset, uint32_t type, int64_t addend) |
Juergen Ributzka | 7608dc0 | 2014-03-21 20:28:42 +0000 | [diff] [blame] | 153 | : SectionID(id), Offset(offset), RelType(type), Addend(addend), |
| 154 | SymOffset(0), IsPCRel(false), Size(0) {} |
Andrew Kaylor | 4612fed | 2013-08-19 23:27:43 +0000 | [diff] [blame] | 155 | |
| 156 | RelocationEntry(unsigned id, uint64_t offset, uint32_t type, int64_t addend, |
| 157 | uint64_t symoffset) |
Juergen Ributzka | 7608dc0 | 2014-03-21 20:28:42 +0000 | [diff] [blame] | 158 | : SectionID(id), Offset(offset), RelType(type), Addend(addend), |
| 159 | SymOffset(symoffset), IsPCRel(false), Size(0) {} |
Rafael Espindola | f1f1c62 | 2013-04-29 17:24:34 +0000 | [diff] [blame] | 160 | |
| 161 | RelocationEntry(unsigned id, uint64_t offset, uint32_t type, int64_t addend, |
| 162 | bool IsPCRel, unsigned Size) |
Juergen Ributzka | 7608dc0 | 2014-03-21 20:28:42 +0000 | [diff] [blame] | 163 | : SectionID(id), Offset(offset), RelType(type), Addend(addend), |
| 164 | SymOffset(0), IsPCRel(IsPCRel), Size(Size) {} |
Lang Hames | 36072da | 2014-05-12 21:39:59 +0000 | [diff] [blame] | 165 | |
| 166 | RelocationEntry(unsigned id, uint64_t offset, uint32_t type, int64_t addend, |
| 167 | unsigned SectionA, uint64_t SectionAOffset, unsigned SectionB, |
| 168 | uint64_t SectionBOffset, bool IsPCRel, unsigned Size) |
| 169 | : SectionID(id), Offset(offset), RelType(type), |
| 170 | Addend(SectionAOffset - SectionBOffset + addend), IsPCRel(IsPCRel), |
| 171 | Size(Size) { |
| 172 | Sections.SectionA = SectionA; |
| 173 | Sections.SectionB = SectionB; |
| 174 | } |
Danil Malyshev | 70d22cc | 2012-03-30 16:45:19 +0000 | [diff] [blame] | 175 | }; |
| 176 | |
Danil Malyshev | 70d22cc | 2012-03-30 16:45:19 +0000 | [diff] [blame] | 177 | class RelocationValueRef { |
| 178 | public: |
Juergen Ributzka | 7608dc0 | 2014-03-21 20:28:42 +0000 | [diff] [blame] | 179 | unsigned SectionID; |
| 180 | uint64_t Offset; |
| 181 | int64_t Addend; |
Danil Malyshev | 70d22cc | 2012-03-30 16:45:19 +0000 | [diff] [blame] | 182 | const char *SymbolName; |
Craig Topper | e73658d | 2014-04-28 04:05:08 +0000 | [diff] [blame] | 183 | RelocationValueRef() : SectionID(0), Offset(0), Addend(0), |
| 184 | SymbolName(nullptr) {} |
Danil Malyshev | 70d22cc | 2012-03-30 16:45:19 +0000 | [diff] [blame] | 185 | |
| 186 | inline bool operator==(const RelocationValueRef &Other) const { |
Benjamin Kramer | 5a71250 | 2013-08-20 09:27:31 +0000 | [diff] [blame] | 187 | return SectionID == Other.SectionID && Offset == Other.Offset && |
| 188 | Addend == Other.Addend && SymbolName == Other.SymbolName; |
Danil Malyshev | 70d22cc | 2012-03-30 16:45:19 +0000 | [diff] [blame] | 189 | } |
Juergen Ributzka | 7608dc0 | 2014-03-21 20:28:42 +0000 | [diff] [blame] | 190 | inline bool operator<(const RelocationValueRef &Other) const { |
Benjamin Kramer | 5a71250 | 2013-08-20 09:27:31 +0000 | [diff] [blame] | 191 | if (SectionID != Other.SectionID) |
| 192 | return SectionID < Other.SectionID; |
| 193 | if (Offset != Other.Offset) |
| 194 | return Offset < Other.Offset; |
| 195 | if (Addend != Other.Addend) |
| 196 | return Addend < Other.Addend; |
| 197 | return SymbolName < Other.SymbolName; |
Danil Malyshev | 70d22cc | 2012-03-30 16:45:19 +0000 | [diff] [blame] | 198 | } |
| 199 | }; |
| 200 | |
Lang Hames | b118603 | 2015-03-11 00:43:26 +0000 | [diff] [blame] | 201 | /// @brief Symbol info for RuntimeDyld. |
Lang Hames | aac59a2 | 2016-08-04 20:32:37 +0000 | [diff] [blame^] | 202 | class SymbolTableEntry { |
Lang Hames | 6bfd398 | 2015-01-16 23:13:56 +0000 | [diff] [blame] | 203 | public: |
Lang Hames | b118603 | 2015-03-11 00:43:26 +0000 | [diff] [blame] | 204 | SymbolTableEntry() |
Lang Hames | aac59a2 | 2016-08-04 20:32:37 +0000 | [diff] [blame^] | 205 | : Offset(0), SectionID(0) {} |
Lang Hames | 6bfd398 | 2015-01-16 23:13:56 +0000 | [diff] [blame] | 206 | |
Lang Hames | b118603 | 2015-03-11 00:43:26 +0000 | [diff] [blame] | 207 | SymbolTableEntry(unsigned SectionID, uint64_t Offset, JITSymbolFlags Flags) |
Lang Hames | aac59a2 | 2016-08-04 20:32:37 +0000 | [diff] [blame^] | 208 | : Offset(Offset), SectionID(SectionID), Flags(Flags) {} |
Lang Hames | 6bfd398 | 2015-01-16 23:13:56 +0000 | [diff] [blame] | 209 | |
| 210 | unsigned getSectionID() const { return SectionID; } |
| 211 | uint64_t getOffset() const { return Offset; } |
Lang Hames | 6bfd398 | 2015-01-16 23:13:56 +0000 | [diff] [blame] | 212 | |
Lang Hames | aac59a2 | 2016-08-04 20:32:37 +0000 | [diff] [blame^] | 213 | JITSymbolFlags getFlags() const { return Flags; } |
| 214 | |
Lang Hames | 6bfd398 | 2015-01-16 23:13:56 +0000 | [diff] [blame] | 215 | private: |
| 216 | uint64_t Offset; |
Lang Hames | b118603 | 2015-03-11 00:43:26 +0000 | [diff] [blame] | 217 | unsigned SectionID; |
Lang Hames | aac59a2 | 2016-08-04 20:32:37 +0000 | [diff] [blame^] | 218 | JITSymbolFlags Flags; |
Lang Hames | 6bfd398 | 2015-01-16 23:13:56 +0000 | [diff] [blame] | 219 | }; |
| 220 | |
Lang Hames | b118603 | 2015-03-11 00:43:26 +0000 | [diff] [blame] | 221 | typedef StringMap<SymbolTableEntry> RTDyldSymbolTable; |
Lang Hames | 6bfd398 | 2015-01-16 23:13:56 +0000 | [diff] [blame] | 222 | |
Danil Malyshev | 72510f2 | 2011-07-13 07:57:58 +0000 | [diff] [blame] | 223 | class RuntimeDyldImpl { |
Lang Hames | b5c7b1f | 2014-11-26 16:54:40 +0000 | [diff] [blame] | 224 | friend class RuntimeDyld::LoadedObjectInfo; |
Lang Hames | f7acddd | 2014-07-22 22:47:39 +0000 | [diff] [blame] | 225 | friend class RuntimeDyldCheckerImpl; |
Danil Malyshev | 72510f2 | 2011-07-13 07:57:58 +0000 | [diff] [blame] | 226 | protected: |
Lang Hames | a32d71b | 2015-10-18 01:41:37 +0000 | [diff] [blame] | 227 | static const unsigned AbsoluteSymbolSection = ~0U; |
| 228 | |
Danil Malyshev | 72510f2 | 2011-07-13 07:57:58 +0000 | [diff] [blame] | 229 | // The MemoryManager to load objects into. |
Lang Hames | 633fe14 | 2015-03-30 03:37:06 +0000 | [diff] [blame] | 230 | RuntimeDyld::MemoryManager &MemMgr; |
| 231 | |
| 232 | // The symbol resolver to use for external symbols. |
Lang Hames | ad4a911 | 2016-08-01 20:49:11 +0000 | [diff] [blame] | 233 | JITSymbolResolver &Resolver; |
Danil Malyshev | 72510f2 | 2011-07-13 07:57:58 +0000 | [diff] [blame] | 234 | |
Lang Hames | f7acddd | 2014-07-22 22:47:39 +0000 | [diff] [blame] | 235 | // Attached RuntimeDyldChecker instance. Null if no instance attached. |
| 236 | RuntimeDyldCheckerImpl *Checker; |
| 237 | |
Eli Bendersky | 32d5488 | 2012-04-30 10:06:27 +0000 | [diff] [blame] | 238 | // A list of all sections emitted by the dynamic linker. These sections are |
| 239 | // referenced in the code by means of their index in this list - SectionID. |
Danil Malyshev | 70d22cc | 2012-03-30 16:45:19 +0000 | [diff] [blame] | 240 | typedef SmallVector<SectionEntry, 64> SectionList; |
| 241 | SectionList Sections; |
Danil Malyshev | 72510f2 | 2011-07-13 07:57:58 +0000 | [diff] [blame] | 242 | |
Andrew Kaylor | 7bb1344 | 2013-10-11 21:25:48 +0000 | [diff] [blame] | 243 | typedef unsigned SID; // Type for SectionIDs |
Keno Fischer | c780e8e | 2015-05-21 21:24:32 +0000 | [diff] [blame] | 244 | #define RTDYLD_INVALID_SECTION_ID ((RuntimeDyldImpl::SID)(-1)) |
Andrew Kaylor | 7bb1344 | 2013-10-11 21:25:48 +0000 | [diff] [blame] | 245 | |
Danil Malyshev | 70d22cc | 2012-03-30 16:45:19 +0000 | [diff] [blame] | 246 | // Keep a map of sections from object file to the SectionID which |
| 247 | // references it. |
| 248 | typedef std::map<SectionRef, unsigned> ObjSectionToIDMap; |
Jim Grosbach | 0ddb3a4 | 2012-01-16 23:50:55 +0000 | [diff] [blame] | 249 | |
Lang Hames | 6bfd398 | 2015-01-16 23:13:56 +0000 | [diff] [blame] | 250 | // A global symbol table for symbols from all loaded modules. |
| 251 | RTDyldSymbolTable GlobalSymbolTable; |
Danil Malyshev | 70d22cc | 2012-03-30 16:45:19 +0000 | [diff] [blame] | 252 | |
Tim Northover | 94bc73d | 2012-10-29 10:47:04 +0000 | [diff] [blame] | 253 | // Keep a map of common symbols to their info pairs |
Lang Hames | 2996895 | 2015-01-17 00:55:05 +0000 | [diff] [blame] | 254 | typedef std::vector<SymbolRef> CommonSymbolList; |
Preston Gurd | 2138ef6 | 2012-04-12 20:13:57 +0000 | [diff] [blame] | 255 | |
Danil Malyshev | 70d22cc | 2012-03-30 16:45:19 +0000 | [diff] [blame] | 256 | // For each symbol, keep a list of relocations based on it. Anytime |
| 257 | // its address is reassigned (the JIT re-compiled the function, e.g.), |
| 258 | // the relocations get re-resolved. |
| 259 | // The symbol (or section) the relocation is sourced from is the Key |
| 260 | // in the relocation list where it's stored. |
| 261 | typedef SmallVector<RelocationEntry, 64> RelocationList; |
| 262 | // Relocations to sections already loaded. Indexed by SectionID which is the |
Benjamin Kramer | bde9176 | 2012-06-02 10:20:22 +0000 | [diff] [blame] | 263 | // source of the address. The target where the address will be written is |
Danil Malyshev | 70d22cc | 2012-03-30 16:45:19 +0000 | [diff] [blame] | 264 | // SectionID/Offset in the relocation itself. |
Keno Fischer | eb59d46 | 2015-12-03 21:27:59 +0000 | [diff] [blame] | 265 | std::unordered_map<unsigned, RelocationList> Relocations; |
Eli Bendersky | b92e1cf | 2012-04-30 12:15:58 +0000 | [diff] [blame] | 266 | |
| 267 | // Relocations to external symbols that are not yet resolved. Symbols are |
| 268 | // external when they aren't found in the global symbol table of all loaded |
| 269 | // modules. This map is indexed by symbol name. |
| 270 | StringMap<RelocationList> ExternalSymbolRelocations; |
Danil Malyshev | 70d22cc | 2012-03-30 16:45:19 +0000 | [diff] [blame] | 271 | |
Lang Hames | f7acddd | 2014-07-22 22:47:39 +0000 | [diff] [blame] | 272 | |
Danil Malyshev | 70d22cc | 2012-03-30 16:45:19 +0000 | [diff] [blame] | 273 | typedef std::map<RelocationValueRef, uintptr_t> StubMap; |
| 274 | |
| 275 | Triple::ArchType Arch; |
Andrew Kaylor | 33c5b1b | 2013-10-15 20:44:55 +0000 | [diff] [blame] | 276 | bool IsTargetLittleEndian; |
Petar Jovanovic | 9720283 | 2015-05-28 13:48:41 +0000 | [diff] [blame] | 277 | bool IsMipsO32ABI; |
| 278 | bool IsMipsN64ABI; |
Danil Malyshev | 70d22cc | 2012-03-30 16:45:19 +0000 | [diff] [blame] | 279 | |
Lang Hames | 868d4b3 | 2014-03-20 21:06:46 +0000 | [diff] [blame] | 280 | // True if all sections should be passed to the memory manager, false if only |
| 281 | // sections containing relocations should be. Defaults to 'false'. |
| 282 | bool ProcessAllSections; |
| 283 | |
Andrew Kaylor | 4fba049 | 2013-10-21 17:42:06 +0000 | [diff] [blame] | 284 | // This mutex prevents simultaneously loading objects from two different |
| 285 | // threads. This keeps us from having to protect individual data structures |
| 286 | // and guarantees that section allocation requests to the memory manager |
| 287 | // won't be interleaved between modules. It is also used in mapSectionAddress |
| 288 | // and resolveRelocations to protect write access to internal data structures. |
| 289 | // |
| 290 | // loadObject may be called on the same thread during the handling of of |
| 291 | // processRelocations, and that's OK. The handling of the relocation lists |
| 292 | // is written in such a way as to work correctly if new elements are added to |
| 293 | // the end of the list while the list is being processed. |
| 294 | sys::Mutex lock; |
| 295 | |
Andrew Kaylor | 2ba21c5 | 2013-10-15 21:32:56 +0000 | [diff] [blame] | 296 | virtual unsigned getMaxStubSize() = 0; |
| 297 | virtual unsigned getStubAlignment() = 0; |
Richard Sandiford | ca04408 | 2013-05-03 14:15:35 +0000 | [diff] [blame] | 298 | |
Danil Malyshev | 72510f2 | 2011-07-13 07:57:58 +0000 | [diff] [blame] | 299 | bool HasError; |
| 300 | std::string ErrorStr; |
| 301 | |
Lang Hames | 3e930a3 | 2014-09-05 18:00:16 +0000 | [diff] [blame] | 302 | uint64_t getSectionLoadAddress(unsigned SectionID) const { |
Sanjoy Das | 277776a | 2015-11-23 21:47:41 +0000 | [diff] [blame] | 303 | return Sections[SectionID].getLoadAddress(); |
Jim Grosbach | dc1123f | 2012-09-05 16:50:40 +0000 | [diff] [blame] | 304 | } |
| 305 | |
Lang Hames | 3e930a3 | 2014-09-05 18:00:16 +0000 | [diff] [blame] | 306 | uint8_t *getSectionAddress(unsigned SectionID) const { |
Sanjoy Das | 277776a | 2015-11-23 21:47:41 +0000 | [diff] [blame] | 307 | return Sections[SectionID].getAddress(); |
Jim Grosbach | eff0a40 | 2012-01-16 22:26:39 +0000 | [diff] [blame] | 308 | } |
Danil Malyshev | 72510f2 | 2011-07-13 07:57:58 +0000 | [diff] [blame] | 309 | |
Adhemerval Zanella | 5fc11b3 | 2012-10-25 13:13:48 +0000 | [diff] [blame] | 310 | void writeInt16BE(uint8_t *Addr, uint16_t Value) { |
Andrew Kaylor | 33c5b1b | 2013-10-15 20:44:55 +0000 | [diff] [blame] | 311 | if (IsTargetLittleEndian) |
Artyom Skrobov | 9aea843 | 2014-06-14 13:18:07 +0000 | [diff] [blame] | 312 | sys::swapByteOrder(Value); |
Juergen Ributzka | 7608dc0 | 2014-03-21 20:28:42 +0000 | [diff] [blame] | 313 | *Addr = (Value >> 8) & 0xFF; |
| 314 | *(Addr + 1) = Value & 0xFF; |
Adhemerval Zanella | 5fc11b3 | 2012-10-25 13:13:48 +0000 | [diff] [blame] | 315 | } |
| 316 | |
| 317 | void writeInt32BE(uint8_t *Addr, uint32_t Value) { |
Andrew Kaylor | 33c5b1b | 2013-10-15 20:44:55 +0000 | [diff] [blame] | 318 | if (IsTargetLittleEndian) |
Artyom Skrobov | 9aea843 | 2014-06-14 13:18:07 +0000 | [diff] [blame] | 319 | sys::swapByteOrder(Value); |
Juergen Ributzka | 7608dc0 | 2014-03-21 20:28:42 +0000 | [diff] [blame] | 320 | *Addr = (Value >> 24) & 0xFF; |
| 321 | *(Addr + 1) = (Value >> 16) & 0xFF; |
| 322 | *(Addr + 2) = (Value >> 8) & 0xFF; |
| 323 | *(Addr + 3) = Value & 0xFF; |
Adhemerval Zanella | 5fc11b3 | 2012-10-25 13:13:48 +0000 | [diff] [blame] | 324 | } |
| 325 | |
| 326 | void writeInt64BE(uint8_t *Addr, uint64_t Value) { |
Andrew Kaylor | 33c5b1b | 2013-10-15 20:44:55 +0000 | [diff] [blame] | 327 | if (IsTargetLittleEndian) |
Artyom Skrobov | 9aea843 | 2014-06-14 13:18:07 +0000 | [diff] [blame] | 328 | sys::swapByteOrder(Value); |
Juergen Ributzka | 7608dc0 | 2014-03-21 20:28:42 +0000 | [diff] [blame] | 329 | *Addr = (Value >> 56) & 0xFF; |
| 330 | *(Addr + 1) = (Value >> 48) & 0xFF; |
| 331 | *(Addr + 2) = (Value >> 40) & 0xFF; |
| 332 | *(Addr + 3) = (Value >> 32) & 0xFF; |
| 333 | *(Addr + 4) = (Value >> 24) & 0xFF; |
| 334 | *(Addr + 5) = (Value >> 16) & 0xFF; |
| 335 | *(Addr + 6) = (Value >> 8) & 0xFF; |
| 336 | *(Addr + 7) = Value & 0xFF; |
Adhemerval Zanella | 5fc11b3 | 2012-10-25 13:13:48 +0000 | [diff] [blame] | 337 | } |
| 338 | |
Petar Jovanovic | 9720283 | 2015-05-28 13:48:41 +0000 | [diff] [blame] | 339 | virtual void setMipsABI(const ObjectFile &Obj) { |
| 340 | IsMipsO32ABI = false; |
| 341 | IsMipsN64ABI = false; |
| 342 | } |
| 343 | |
Lang Hames | e1287c0 | 2014-08-29 23:17:47 +0000 | [diff] [blame] | 344 | /// Endian-aware read Read the least significant Size bytes from Src. |
| 345 | uint64_t readBytesUnaligned(uint8_t *Src, unsigned Size) const; |
| 346 | |
| 347 | /// Endian-aware write. Write the least significant Size bytes from Value to |
| 348 | /// Dst. |
| 349 | void writeBytesUnaligned(uint64_t Value, uint8_t *Dst, unsigned Size) const; |
| 350 | |
Eli Bendersky | 667b879 | 2012-05-01 10:41:12 +0000 | [diff] [blame] | 351 | /// \brief Given the common symbols discovered in the object file, emit a |
| 352 | /// new section for them and update the symbol mappings in the object and |
| 353 | /// symbol table. |
Lang Hames | 8959531 | 2016-04-27 20:24:48 +0000 | [diff] [blame] | 354 | Error emitCommonSymbols(const ObjectFile &Obj, |
| 355 | CommonSymbolList &CommonSymbols); |
Preston Gurd | 2138ef6 | 2012-04-12 20:13:57 +0000 | [diff] [blame] | 356 | |
Danil Malyshev | 70d22cc | 2012-03-30 16:45:19 +0000 | [diff] [blame] | 357 | /// \brief Emits section data from the object file to the MemoryManager. |
| 358 | /// \param IsCode if it's true then allocateCodeSection() will be |
Eli Bendersky | 0e2ac5b | 2012-04-29 12:40:47 +0000 | [diff] [blame] | 359 | /// used for emits, else allocateDataSection() will be used. |
Danil Malyshev | 70d22cc | 2012-03-30 16:45:19 +0000 | [diff] [blame] | 360 | /// \return SectionID. |
Lang Hames | 8959531 | 2016-04-27 20:24:48 +0000 | [diff] [blame] | 361 | Expected<unsigned> emitSection(const ObjectFile &Obj, |
| 362 | const SectionRef &Section, |
| 363 | bool IsCode); |
Danil Malyshev | 70d22cc | 2012-03-30 16:45:19 +0000 | [diff] [blame] | 364 | |
| 365 | /// \brief Find Section in LocalSections. If the secton is not found - emit |
| 366 | /// it and store in LocalSections. |
| 367 | /// \param IsCode if it's true then allocateCodeSection() will be |
| 368 | /// used for emmits, else allocateDataSection() will be used. |
| 369 | /// \return SectionID. |
Lang Hames | 8959531 | 2016-04-27 20:24:48 +0000 | [diff] [blame] | 370 | Expected<unsigned> findOrEmitSection(const ObjectFile &Obj, |
| 371 | const SectionRef &Section, bool IsCode, |
| 372 | ObjSectionToIDMap &LocalSections); |
Danil Malyshev | 70d22cc | 2012-03-30 16:45:19 +0000 | [diff] [blame] | 373 | |
Eli Bendersky | 667b879 | 2012-05-01 10:41:12 +0000 | [diff] [blame] | 374 | // \brief Add a relocation entry that uses the given section. |
| 375 | void addRelocationForSection(const RelocationEntry &RE, unsigned SectionID); |
| 376 | |
| 377 | // \brief Add a relocation entry that uses the given symbol. This symbol may |
| 378 | // be found in the global symbol table, or it may be external. |
| 379 | void addRelocationForSymbol(const RelocationEntry &RE, StringRef SymbolName); |
Danil Malyshev | 70d22cc | 2012-03-30 16:45:19 +0000 | [diff] [blame] | 380 | |
| 381 | /// \brief Emits long jump instruction to Addr. |
| 382 | /// \return Pointer to the memory area for emitting target address. |
Ulrich Weigand | 752b5c9 | 2014-07-20 23:53:14 +0000 | [diff] [blame] | 383 | uint8_t *createStubFunction(uint8_t *Addr, unsigned AbiVariant = 0); |
Danil Malyshev | 70d22cc | 2012-03-30 16:45:19 +0000 | [diff] [blame] | 384 | |
| 385 | /// \brief Resolves relocations from Relocs list with address from Value. |
| 386 | void resolveRelocationList(const RelocationList &Relocs, uint64_t Value); |
Danil Malyshev | 70d22cc | 2012-03-30 16:45:19 +0000 | [diff] [blame] | 387 | |
| 388 | /// \brief A object file specific relocation resolver |
Rafael Espindola | b39478e | 2013-04-29 19:33:51 +0000 | [diff] [blame] | 389 | /// \param RE The relocation to be resolved |
Danil Malyshev | 70d22cc | 2012-03-30 16:45:19 +0000 | [diff] [blame] | 390 | /// \param Value Target symbol address to apply the relocation action |
Rafael Espindola | f1f1c62 | 2013-04-29 17:24:34 +0000 | [diff] [blame] | 391 | virtual void resolveRelocation(const RelocationEntry &RE, uint64_t Value) = 0; |
Danil Malyshev | 70d22cc | 2012-03-30 16:45:19 +0000 | [diff] [blame] | 392 | |
Juergen Ributzka | 838282e | 2014-03-21 20:38:46 +0000 | [diff] [blame] | 393 | /// \brief Parses one or more object file relocations (some object files use |
| 394 | /// relocation pairs) and stores it to Relocations or SymbolRelocations |
| 395 | /// (this depends on the object file type). |
| 396 | /// \return Iterator to the next relocation that needs to be parsed. |
Lang Hames | 8959531 | 2016-04-27 20:24:48 +0000 | [diff] [blame] | 397 | virtual Expected<relocation_iterator> |
Juergen Ributzka | 046709f | 2014-03-21 07:26:41 +0000 | [diff] [blame] | 398 | processRelocationRef(unsigned SectionID, relocation_iterator RelI, |
Lang Hames | b5c7b1f | 2014-11-26 16:54:40 +0000 | [diff] [blame] | 399 | const ObjectFile &Obj, ObjSectionToIDMap &ObjSectionToID, |
Lang Hames | a5cd950 | 2014-11-27 05:40:13 +0000 | [diff] [blame] | 400 | StubMap &Stubs) = 0; |
Danil Malyshev | 70d22cc | 2012-03-30 16:45:19 +0000 | [diff] [blame] | 401 | |
Eli Bendersky | b92e1cf | 2012-04-30 12:15:58 +0000 | [diff] [blame] | 402 | /// \brief Resolve relocations to external symbols. |
| 403 | void resolveExternalSymbols(); |
Andrew Kaylor | 4612fed | 2013-08-19 23:27:43 +0000 | [diff] [blame] | 404 | |
Juergen Ributzka | 7608dc0 | 2014-03-21 20:28:42 +0000 | [diff] [blame] | 405 | // \brief Compute an upper bound of the memory that is required to load all |
| 406 | // sections |
Lang Hames | 8959531 | 2016-04-27 20:24:48 +0000 | [diff] [blame] | 407 | Error computeTotalAllocSize(const ObjectFile &Obj, |
| 408 | uint64_t &CodeSize, uint32_t &CodeAlign, |
| 409 | uint64_t &RODataSize, uint32_t &RODataAlign, |
| 410 | uint64_t &RWDataSize, uint32_t &RWDataAlign); |
Juergen Ributzka | 7608dc0 | 2014-03-21 20:28:42 +0000 | [diff] [blame] | 411 | |
Lang Hames | 937ec54 | 2014-02-12 21:30:07 +0000 | [diff] [blame] | 412 | // \brief Compute the stub buffer size required for a section |
Lang Hames | b5c7b1f | 2014-11-26 16:54:40 +0000 | [diff] [blame] | 413 | unsigned computeSectionStubBufSize(const ObjectFile &Obj, |
Juergen Ributzka | 046709f | 2014-03-21 07:26:41 +0000 | [diff] [blame] | 414 | const SectionRef &Section); |
Lang Hames | 937ec54 | 2014-02-12 21:30:07 +0000 | [diff] [blame] | 415 | |
Lang Hames | b5c7b1f | 2014-11-26 16:54:40 +0000 | [diff] [blame] | 416 | // \brief Implementation of the generic part of the loadObject algorithm. |
Lang Hames | 8959531 | 2016-04-27 20:24:48 +0000 | [diff] [blame] | 417 | Expected<ObjSectionToIDMap> loadObjectImpl(const object::ObjectFile &Obj); |
Lang Hames | b5c7b1f | 2014-11-26 16:54:40 +0000 | [diff] [blame] | 418 | |
Sanjoy Das | d5658b0 | 2015-11-23 21:47:51 +0000 | [diff] [blame] | 419 | // \brief Return true if the relocation R may require allocating a stub. |
| 420 | virtual bool relocationNeedsStub(const RelocationRef &R) const { |
| 421 | return true; // Conservative answer |
| 422 | } |
| 423 | |
Danil Malyshev | 72510f2 | 2011-07-13 07:57:58 +0000 | [diff] [blame] | 424 | public: |
Lang Hames | 633fe14 | 2015-03-30 03:37:06 +0000 | [diff] [blame] | 425 | RuntimeDyldImpl(RuntimeDyld::MemoryManager &MemMgr, |
Lang Hames | ad4a911 | 2016-08-01 20:49:11 +0000 | [diff] [blame] | 426 | JITSymbolResolver &Resolver) |
Lang Hames | 633fe14 | 2015-03-30 03:37:06 +0000 | [diff] [blame] | 427 | : MemMgr(MemMgr), Resolver(Resolver), Checker(nullptr), |
| 428 | ProcessAllSections(false), HasError(false) { |
Lang Hames | e1c1138 | 2014-06-27 20:20:57 +0000 | [diff] [blame] | 429 | } |
Danil Malyshev | 72510f2 | 2011-07-13 07:57:58 +0000 | [diff] [blame] | 430 | |
| 431 | virtual ~RuntimeDyldImpl(); |
| 432 | |
Lang Hames | 868d4b3 | 2014-03-20 21:06:46 +0000 | [diff] [blame] | 433 | void setProcessAllSections(bool ProcessAllSections) { |
| 434 | this->ProcessAllSections = ProcessAllSections; |
| 435 | } |
| 436 | |
Lang Hames | f7acddd | 2014-07-22 22:47:39 +0000 | [diff] [blame] | 437 | void setRuntimeDyldChecker(RuntimeDyldCheckerImpl *Checker) { |
| 438 | this->Checker = Checker; |
| 439 | } |
| 440 | |
Lang Hames | b5c7b1f | 2014-11-26 16:54:40 +0000 | [diff] [blame] | 441 | virtual std::unique_ptr<RuntimeDyld::LoadedObjectInfo> |
| 442 | loadObject(const object::ObjectFile &Obj) = 0; |
Danil Malyshev | 72510f2 | 2011-07-13 07:57:58 +0000 | [diff] [blame] | 443 | |
Lang Hames | b118603 | 2015-03-11 00:43:26 +0000 | [diff] [blame] | 444 | uint8_t* getSymbolLocalAddress(StringRef Name) const { |
Danil Malyshev | 72510f2 | 2011-07-13 07:57:58 +0000 | [diff] [blame] | 445 | // FIXME: Just look up as a function for now. Overly simple of course. |
| 446 | // Work in progress. |
Lang Hames | 6bfd398 | 2015-01-16 23:13:56 +0000 | [diff] [blame] | 447 | RTDyldSymbolTable::const_iterator pos = GlobalSymbolTable.find(Name); |
Yaron Keren | c980288 | 2013-10-19 09:04:26 +0000 | [diff] [blame] | 448 | if (pos == GlobalSymbolTable.end()) |
Craig Topper | e73658d | 2014-04-28 04:05:08 +0000 | [diff] [blame] | 449 | return nullptr; |
Lang Hames | 6bfd398 | 2015-01-16 23:13:56 +0000 | [diff] [blame] | 450 | const auto &SymInfo = pos->second; |
Lang Hames | a32d71b | 2015-10-18 01:41:37 +0000 | [diff] [blame] | 451 | // Absolute symbols do not have a local address. |
| 452 | if (SymInfo.getSectionID() == AbsoluteSymbolSection) |
| 453 | return nullptr; |
Lang Hames | 6bfd398 | 2015-01-16 23:13:56 +0000 | [diff] [blame] | 454 | return getSectionAddress(SymInfo.getSectionID()) + SymInfo.getOffset(); |
Danil Malyshev | 72510f2 | 2011-07-13 07:57:58 +0000 | [diff] [blame] | 455 | } |
| 456 | |
Lang Hames | ad4a911 | 2016-08-01 20:49:11 +0000 | [diff] [blame] | 457 | JITEvaluatedSymbol getSymbol(StringRef Name) const { |
Jim Grosbach | dc1123f | 2012-09-05 16:50:40 +0000 | [diff] [blame] | 458 | // FIXME: Just look up as a function for now. Overly simple of course. |
| 459 | // Work in progress. |
Lang Hames | 6bfd398 | 2015-01-16 23:13:56 +0000 | [diff] [blame] | 460 | RTDyldSymbolTable::const_iterator pos = GlobalSymbolTable.find(Name); |
Yaron Keren | c980288 | 2013-10-19 09:04:26 +0000 | [diff] [blame] | 461 | if (pos == GlobalSymbolTable.end()) |
Lang Hames | b118603 | 2015-03-11 00:43:26 +0000 | [diff] [blame] | 462 | return nullptr; |
| 463 | const auto &SymEntry = pos->second; |
Lang Hames | a32d71b | 2015-10-18 01:41:37 +0000 | [diff] [blame] | 464 | uint64_t SectionAddr = 0; |
| 465 | if (SymEntry.getSectionID() != AbsoluteSymbolSection) |
| 466 | SectionAddr = getSectionLoadAddress(SymEntry.getSectionID()); |
| 467 | uint64_t TargetAddr = SectionAddr + SymEntry.getOffset(); |
Lang Hames | ad4a911 | 2016-08-01 20:49:11 +0000 | [diff] [blame] | 468 | return JITEvaluatedSymbol(TargetAddr, SymEntry.getFlags()); |
Jim Grosbach | dc1123f | 2012-09-05 16:50:40 +0000 | [diff] [blame] | 469 | } |
| 470 | |
Danil Malyshev | 70d22cc | 2012-03-30 16:45:19 +0000 | [diff] [blame] | 471 | void resolveRelocations(); |
Danil Malyshev | 72510f2 | 2011-07-13 07:57:58 +0000 | [diff] [blame] | 472 | |
Danil Malyshev | 70d22cc | 2012-03-30 16:45:19 +0000 | [diff] [blame] | 473 | void reassignSectionAddress(unsigned SectionID, uint64_t Addr); |
Danil Malyshev | 72510f2 | 2011-07-13 07:57:58 +0000 | [diff] [blame] | 474 | |
Jim Grosbach | 6d61397 | 2012-09-13 21:50:06 +0000 | [diff] [blame] | 475 | void mapSectionAddress(const void *LocalAddress, uint64_t TargetAddress); |
Jim Grosbach | 0ddb3a4 | 2012-01-16 23:50:55 +0000 | [diff] [blame] | 476 | |
Danil Malyshev | 72510f2 | 2011-07-13 07:57:58 +0000 | [diff] [blame] | 477 | // Is the linker in an error state? |
| 478 | bool hasError() { return HasError; } |
| 479 | |
| 480 | // Mark the error condition as handled and continue. |
| 481 | void clearError() { HasError = false; } |
| 482 | |
| 483 | // Get the error message. |
| 484 | StringRef getErrorString() { return ErrorStr; } |
| 485 | |
Lang Hames | b5c7b1f | 2014-11-26 16:54:40 +0000 | [diff] [blame] | 486 | virtual bool isCompatibleFile(const ObjectFile &Obj) const = 0; |
Rafael Espindola | fa5942b | 2013-05-05 20:43:10 +0000 | [diff] [blame] | 487 | |
Andrew Kaylor | 7bb1344 | 2013-10-11 21:25:48 +0000 | [diff] [blame] | 488 | virtual void registerEHFrames(); |
Andrew Kaylor | 4612fed | 2013-08-19 23:27:43 +0000 | [diff] [blame] | 489 | |
Andrew Kaylor | c442a76 | 2013-10-16 00:14:21 +0000 | [diff] [blame] | 490 | virtual void deregisterEHFrames(); |
| 491 | |
Lang Hames | 8959531 | 2016-04-27 20:24:48 +0000 | [diff] [blame] | 492 | virtual Error finalizeLoad(const ObjectFile &ObjImg, |
| 493 | ObjSectionToIDMap &SectionMap) { |
| 494 | return Error::success(); |
| 495 | } |
Danil Malyshev | 72510f2 | 2011-07-13 07:57:58 +0000 | [diff] [blame] | 496 | }; |
| 497 | |
Danil Malyshev | 72510f2 | 2011-07-13 07:57:58 +0000 | [diff] [blame] | 498 | } // end namespace llvm |
| 499 | |
Danil Malyshev | 72510f2 | 2011-07-13 07:57:58 +0000 | [diff] [blame] | 500 | #endif |