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