| Michael J. Spencer | e68f903 | 2013-01-29 22:03:39 +0000 | [diff] [blame] | 1 | //===- lib/ReaderWriter/ELF/SectionChunks.h -------------------------------===// |
| Shankar Easwaran | 6d9921f | 2013-01-21 20:09:55 +0000 | [diff] [blame] | 2 | // |
| 3 | // The LLVM Linker |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| Michael J. Spencer | e68f903 | 2013-01-29 22:03:39 +0000 | [diff] [blame] | 10 | #ifndef LLD_READER_WRITER_ELF_SECTION_CHUNKS_H |
| 11 | #define LLD_READER_WRITER_ELF_SECTION_CHUNKS_H |
| Shankar Easwaran | 6d9921f | 2013-01-21 20:09:55 +0000 | [diff] [blame] | 12 | |
| Michael J. Spencer | e68f903 | 2013-01-29 22:03:39 +0000 | [diff] [blame] | 13 | #include "Chunk.h" |
| 14 | #include "Layout.h" |
| 15 | #include "TargetHandler.h" |
| 16 | #include "Writer.h" |
| Michael J. Spencer | 43ecac5 | 2013-01-29 19:53:41 +0000 | [diff] [blame] | 17 | |
| Shankar Easwaran | 6d9921f | 2013-01-21 20:09:55 +0000 | [diff] [blame] | 18 | #include "lld/Core/DefinedAtom.h" |
| 19 | #include "lld/Core/range.h" |
| 20 | |
| 21 | #include "llvm/ADT/ArrayRef.h" |
| 22 | #include "llvm/ADT/OwningPtr.h" |
| 23 | #include "llvm/ADT/StringRef.h" |
| Shankar Easwaran | 6d9921f | 2013-01-21 20:09:55 +0000 | [diff] [blame] | 24 | #include "llvm/Object/ELF.h" |
| Shankar Easwaran | 6d9921f | 2013-01-21 20:09:55 +0000 | [diff] [blame] | 25 | #include "llvm/Support/Allocator.h" |
| 26 | #include "llvm/Support/Debug.h" |
| 27 | #include "llvm/Support/ELF.h" |
| 28 | #include "llvm/Support/ErrorHandling.h" |
| 29 | #include "llvm/Support/FileOutputBuffer.h" |
| 30 | |
| Shankar Easwaran | 6d9921f | 2013-01-21 20:09:55 +0000 | [diff] [blame] | 31 | namespace lld { |
| 32 | namespace elf { |
| 33 | |
| 34 | /// \brief A section contains a set of atoms that have similiar properties |
| 35 | /// The atoms that have similiar properties are merged to form a section |
| 36 | template<class ELFT> |
| 37 | class Section : public Chunk<ELFT> { |
| 38 | public: |
| 39 | // The Kind of section that the object represents |
| 40 | enum SectionKind { |
| 41 | K_Default, |
| 42 | K_Target, // The section is handed over to the target |
| 43 | K_SymbolTable, |
| 44 | K_StringTable, |
| 45 | }; |
| 46 | // Create a section object, the section is set to the default type if the |
| 47 | // caller doesnot set it |
| Michael J. Spencer | e68f903 | 2013-01-29 22:03:39 +0000 | [diff] [blame] | 48 | Section(const ELFTargetInfo &, const StringRef sectionName, |
| Michael J. Spencer | bf77be3 | 2013-01-29 01:07:47 +0000 | [diff] [blame] | 49 | const int32_t contentType, const int32_t contentPermissions, |
| 50 | const int32_t order, const SectionKind kind = K_Default); |
| Shankar Easwaran | 6d9921f | 2013-01-21 20:09:55 +0000 | [diff] [blame] | 51 | |
| 52 | /// return the section kind |
| 53 | inline SectionKind sectionKind() const { |
| 54 | return _sectionKind; |
| 55 | } |
| 56 | |
| 57 | /// Align the offset to the required modulus defined by the atom alignment |
| 58 | uint64_t alignOffset(uint64_t offset, DefinedAtom::Alignment &atomAlign); |
| 59 | |
| 60 | // \brief Append an atom to a Section. The atom gets pushed into a vector |
| 61 | // contains the atom, the atom file offset, the atom virtual address |
| 62 | // the atom file offset is aligned appropriately as set by the Reader |
| Michael J. Spencer | 4260657 | 2013-01-30 01:25:06 +0000 | [diff] [blame] | 63 | const AtomLayout &appendAtom(const Atom *atom); |
| Shankar Easwaran | 6d9921f | 2013-01-21 20:09:55 +0000 | [diff] [blame] | 64 | |
| 65 | /// \brief Set the virtual address of each Atom in the Section. This |
| 66 | /// routine gets called after the linker fixes up the virtual address |
| 67 | /// of the section |
| 68 | inline void assignVirtualAddress(uint64_t &addr) { |
| 69 | for (auto &ai : _atoms) { |
| Michael J. Spencer | 4260657 | 2013-01-30 01:25:06 +0000 | [diff] [blame] | 70 | ai->_virtualAddr = addr + ai->_fileOffset; |
| Shankar Easwaran | 6d9921f | 2013-01-21 20:09:55 +0000 | [diff] [blame] | 71 | } |
| 72 | addr += this->memSize(); |
| 73 | } |
| 74 | |
| 75 | /// \brief Set the file offset of each Atom in the section. This routine |
| 76 | /// gets called after the linker fixes up the section offset |
| 77 | inline void assignOffsets(uint64_t offset) { |
| 78 | for (auto &ai : _atoms) { |
| Michael J. Spencer | 4260657 | 2013-01-30 01:25:06 +0000 | [diff] [blame] | 79 | ai->_fileOffset = offset + ai->_fileOffset; |
| Shankar Easwaran | 6d9921f | 2013-01-21 20:09:55 +0000 | [diff] [blame] | 80 | } |
| 81 | } |
| 82 | |
| 83 | /// \brief Find the Atom address given a name, this is needed to to properly |
| 84 | /// apply relocation. The section class calls this to find the atom address |
| 85 | /// to fix the relocation |
| Michael J. Spencer | e68f903 | 2013-01-29 22:03:39 +0000 | [diff] [blame] | 86 | inline bool findAtomAddrByName(const StringRef name, uint64_t &addr) { |
| Shankar Easwaran | 6d9921f | 2013-01-21 20:09:55 +0000 | [diff] [blame] | 87 | for (auto ai : _atoms) { |
| Michael J. Spencer | 4260657 | 2013-01-30 01:25:06 +0000 | [diff] [blame] | 88 | if (ai->_atom->name() == name) { |
| 89 | addr = ai->_virtualAddr; |
| Shankar Easwaran | 6d9921f | 2013-01-21 20:09:55 +0000 | [diff] [blame] | 90 | return true; |
| 91 | } |
| 92 | } |
| 93 | return false; |
| 94 | } |
| 95 | |
| 96 | /// \brief Does the Atom occupy any disk space |
| 97 | inline bool occupiesNoDiskSpace() const { |
| 98 | return _contentType == DefinedAtom::typeZeroFill; |
| 99 | } |
| 100 | |
| 101 | /// \brief The permission of the section is the most permissive permission |
| 102 | /// of all atoms that the section contains |
| 103 | inline void setContentPermissions(int32_t perm) { |
| 104 | _contentPermissions = std::max(perm, _contentPermissions); |
| 105 | } |
| 106 | |
| 107 | /// \brief Get the section flags, defined by the permissions of the section |
| 108 | int64_t flags(); |
| 109 | |
| 110 | /// \brief Return the section type, the returned value is recorded in the |
| 111 | /// sh_type field of the Section Header |
| 112 | int type(); |
| 113 | |
| 114 | /// \brief convert the segment type to a String for diagnostics |
| 115 | /// and printing purposes |
| Michael J. Spencer | e68f903 | 2013-01-29 22:03:39 +0000 | [diff] [blame] | 116 | StringRef segmentKindToStr() const; |
| Shankar Easwaran | 6d9921f | 2013-01-21 20:09:55 +0000 | [diff] [blame] | 117 | |
| 118 | /// \brief Return the raw flags, we need this to sort segments |
| 119 | inline int64_t atomflags() const { |
| 120 | return _contentPermissions; |
| 121 | } |
| 122 | |
| 123 | /// \brief Returns the section link field, the returned value is |
| 124 | /// recorded in the sh_link field of the Section Header |
| 125 | inline int link() const { |
| 126 | return _link; |
| 127 | } |
| 128 | |
| 129 | inline void setLink(int32_t link) { |
| 130 | _link = link; |
| 131 | } |
| 132 | |
| 133 | /// \brief Returns the section entsize field, the returned value is |
| 134 | /// recorded in the sh_entsize field of the Section Header |
| 135 | inline int entsize() const { |
| 136 | return _entSize; |
| 137 | } |
| 138 | |
| 139 | /// \brief Returns the shinfo field, the returned value is |
| 140 | /// recorded in the sh_info field of the Section Header |
| 141 | inline int shinfo() const { |
| 142 | return _shInfo; |
| 143 | } |
| 144 | |
| 145 | /// \brief Records the segmentType, that this section belongs to |
| Michael J. Spencer | e68f903 | 2013-01-29 22:03:39 +0000 | [diff] [blame] | 146 | inline void setSegment(const Layout::SegmentType segmentType) { |
| Shankar Easwaran | 6d9921f | 2013-01-21 20:09:55 +0000 | [diff] [blame] | 147 | _segmentType = segmentType; |
| 148 | } |
| 149 | |
| 150 | /// \brief for LLVM style RTTI information |
| 151 | static inline bool classof(const Chunk<ELFT> *c) { |
| 152 | return c->kind() == Chunk<ELFT>::K_ELFSection; |
| 153 | } |
| 154 | |
| 155 | /// \brief Finalize the section contents before writing |
| 156 | inline void finalize() { } |
| 157 | |
| 158 | /// \brief Write the section and the atom contents to the buffer |
| Michael J. Spencer | adfb7eb | 2013-01-29 01:00:21 +0000 | [diff] [blame] | 159 | void write(ELFWriter *writer, llvm::FileOutputBuffer &buffer); |
| Shankar Easwaran | 6d9921f | 2013-01-21 20:09:55 +0000 | [diff] [blame] | 160 | |
| 161 | /// Atom Iterators |
| Michael J. Spencer | 4260657 | 2013-01-30 01:25:06 +0000 | [diff] [blame] | 162 | typedef typename std::vector<AtomLayout *>::iterator atom_iter; |
| Shankar Easwaran | 6d9921f | 2013-01-21 20:09:55 +0000 | [diff] [blame] | 163 | |
| 164 | range<atom_iter> atoms() { return _atoms; } |
| 165 | |
| 166 | protected: |
| 167 | int32_t _contentType; |
| 168 | int32_t _contentPermissions; |
| 169 | SectionKind _sectionKind; |
| Michael J. Spencer | 4260657 | 2013-01-30 01:25:06 +0000 | [diff] [blame] | 170 | std::vector<AtomLayout *> _atoms; |
| Michael J. Spencer | e68f903 | 2013-01-29 22:03:39 +0000 | [diff] [blame] | 171 | Layout::SegmentType _segmentType; |
| Shankar Easwaran | 6d9921f | 2013-01-21 20:09:55 +0000 | [diff] [blame] | 172 | int64_t _entSize; |
| 173 | int64_t _shInfo; |
| 174 | int64_t _link; |
| Michael J. Spencer | 4260657 | 2013-01-30 01:25:06 +0000 | [diff] [blame] | 175 | llvm::BumpPtrAllocator _alloc; |
| Shankar Easwaran | 6d9921f | 2013-01-21 20:09:55 +0000 | [diff] [blame] | 176 | }; |
| 177 | |
| 178 | // Create a section object, the section is set to the default type if the |
| 179 | // caller doesnot set it |
| Michael J. Spencer | bf77be3 | 2013-01-29 01:07:47 +0000 | [diff] [blame] | 180 | template <class ELFT> |
| 181 | Section<ELFT>::Section(const ELFTargetInfo &ti, const StringRef sectionName, |
| Shankar Easwaran | 6d9921f | 2013-01-21 20:09:55 +0000 | [diff] [blame] | 182 | const int32_t contentType, |
| Michael J. Spencer | bf77be3 | 2013-01-29 01:07:47 +0000 | [diff] [blame] | 183 | const int32_t contentPermissions, const int32_t order, |
| Shankar Easwaran | 6d9921f | 2013-01-21 20:09:55 +0000 | [diff] [blame] | 184 | const SectionKind kind) |
| Michael J. Spencer | bf77be3 | 2013-01-29 01:07:47 +0000 | [diff] [blame] | 185 | : Chunk<ELFT>(sectionName, Chunk<ELFT>::K_ELFSection, ti), |
| 186 | _contentType(contentType), _contentPermissions(contentPermissions), |
| 187 | _sectionKind(kind), _entSize(0), _shInfo(0), _link(0) { |
| Shankar Easwaran | 6d9921f | 2013-01-21 20:09:55 +0000 | [diff] [blame] | 188 | this->setOrder(order); |
| 189 | } |
| 190 | |
| 191 | /// Align the offset to the required modulus defined by the atom alignment |
| 192 | template<class ELFT> |
| 193 | uint64_t |
| 194 | Section<ELFT>::alignOffset(uint64_t offset, DefinedAtom::Alignment &atomAlign) { |
| 195 | uint64_t requiredModulus = atomAlign.modulus; |
| 196 | uint64_t align2 = 1u << atomAlign.powerOf2; |
| 197 | uint64_t currentModulus = (offset % align2); |
| 198 | uint64_t retOffset = offset; |
| 199 | if (currentModulus != requiredModulus) { |
| 200 | if (requiredModulus > currentModulus) |
| 201 | retOffset += requiredModulus - currentModulus; |
| 202 | else |
| 203 | retOffset += align2 + requiredModulus - currentModulus; |
| 204 | } |
| 205 | return retOffset; |
| 206 | } |
| 207 | |
| 208 | // \brief Append an atom to a Section. The atom gets pushed into a vector |
| 209 | // contains the atom, the atom file offset, the atom virtual address |
| 210 | // the atom file offset is aligned appropriately as set by the Reader |
| Michael J. Spencer | 4260657 | 2013-01-30 01:25:06 +0000 | [diff] [blame] | 211 | template <class ELFT> |
| 212 | const AtomLayout &Section<ELFT>::appendAtom(const Atom *atom) { |
| Shankar Easwaran | 6d9921f | 2013-01-21 20:09:55 +0000 | [diff] [blame] | 213 | Atom::Definition atomType = atom->definition(); |
| 214 | const DefinedAtom *definedAtom = cast<DefinedAtom>(atom); |
| 215 | |
| 216 | DefinedAtom::Alignment atomAlign = definedAtom->alignment(); |
| 217 | uint64_t align2 = 1u << atomAlign.powerOf2; |
| 218 | // Align the atom to the required modulus/ align the file offset and the |
| 219 | // memory offset seperately this is required so that BSS symbols are handled |
| 220 | // properly as the BSS symbols only occupy memory size and not file size |
| 221 | uint64_t fOffset = alignOffset(this->fileSize(), atomAlign); |
| 222 | uint64_t mOffset = alignOffset(this->memSize(), atomAlign); |
| 223 | switch (atomType) { |
| 224 | case Atom::definitionRegular: |
| 225 | switch(definedAtom->contentType()) { |
| 226 | case DefinedAtom::typeCode: |
| 227 | case DefinedAtom::typeData: |
| 228 | case DefinedAtom::typeConstant: |
| Michael J. Spencer | 289dced | 2013-01-29 16:38:03 +0000 | [diff] [blame] | 229 | case DefinedAtom::typeGOT: |
| 230 | case DefinedAtom::typeStub: |
| 231 | case DefinedAtom::typeResolver: |
| Michael J. Spencer | 4260657 | 2013-01-30 01:25:06 +0000 | [diff] [blame] | 232 | _atoms.push_back(new (_alloc) AtomLayout(atom, fOffset, 0)); |
| Shankar Easwaran | 6d9921f | 2013-01-21 20:09:55 +0000 | [diff] [blame] | 233 | this->_fsize = fOffset + definedAtom->size(); |
| 234 | this->_msize = mOffset + definedAtom->size(); |
| Michael J. Spencer | 289dced | 2013-01-29 16:38:03 +0000 | [diff] [blame] | 235 | DEBUG_WITH_TYPE("Section", |
| 236 | llvm::dbgs() << "[" << this->name() << " " << this << "] " |
| 237 | << "Adding atom: " << atom->name() << "@" |
| 238 | << fOffset << "\n"); |
| Shankar Easwaran | 6d9921f | 2013-01-21 20:09:55 +0000 | [diff] [blame] | 239 | break; |
| 240 | case DefinedAtom::typeZeroFill: |
| Michael J. Spencer | 4260657 | 2013-01-30 01:25:06 +0000 | [diff] [blame] | 241 | _atoms.push_back(new (_alloc) AtomLayout(atom, mOffset, 0)); |
| Shankar Easwaran | 6d9921f | 2013-01-21 20:09:55 +0000 | [diff] [blame] | 242 | this->_msize = mOffset + definedAtom->size(); |
| 243 | break; |
| 244 | default: |
| Michael J. Spencer | 4260657 | 2013-01-30 01:25:06 +0000 | [diff] [blame] | 245 | llvm::dbgs() << definedAtom->contentType() << "\n"; |
| 246 | llvm_unreachable("Uexpected content type."); |
| Shankar Easwaran | 6d9921f | 2013-01-21 20:09:55 +0000 | [diff] [blame] | 247 | } |
| 248 | break; |
| 249 | default: |
| 250 | llvm_unreachable("Expecting only definedAtoms being passed here"); |
| 251 | break; |
| 252 | } |
| 253 | // Set the section alignment to the largest alignment |
| 254 | // std::max doesnot support uint64_t |
| 255 | if (this->_align2 < align2) |
| 256 | this->_align2 = align2; |
| Michael J. Spencer | 4260657 | 2013-01-30 01:25:06 +0000 | [diff] [blame] | 257 | |
| 258 | return *_atoms.back(); |
| Shankar Easwaran | 6d9921f | 2013-01-21 20:09:55 +0000 | [diff] [blame] | 259 | } |
| 260 | |
| 261 | /// \brief Get the section flags, defined by the permissions of the section |
| 262 | template<class ELFT> |
| 263 | int64_t |
| 264 | Section<ELFT>::flags() { |
| 265 | switch (_contentPermissions) { |
| 266 | case DefinedAtom::perm___: |
| 267 | return 0; |
| 268 | |
| 269 | case DefinedAtom::permR__: |
| 270 | return llvm::ELF::SHF_ALLOC; |
| 271 | |
| 272 | case DefinedAtom::permR_X: |
| 273 | return llvm::ELF::SHF_ALLOC | llvm::ELF::SHF_EXECINSTR; |
| 274 | |
| 275 | case DefinedAtom::permRW_: |
| 276 | case DefinedAtom::permRW_L: |
| 277 | return llvm::ELF::SHF_ALLOC | llvm::ELF::SHF_WRITE; |
| 278 | |
| 279 | case DefinedAtom::permRWX: |
| 280 | return llvm::ELF::SHF_ALLOC | |
| 281 | llvm::ELF::SHF_WRITE | |
| 282 | llvm::ELF::SHF_EXECINSTR; |
| 283 | |
| 284 | default: |
| 285 | break; |
| 286 | } |
| 287 | return llvm::ELF::SHF_ALLOC; |
| 288 | } |
| 289 | |
| 290 | /// \brief Return the section type, the returned value is recorded in the |
| 291 | /// sh_type field of the Section Header |
| 292 | |
| 293 | template<class ELFT> |
| 294 | int |
| 295 | Section<ELFT>::type() { |
| Michael J. Spencer | 289dced | 2013-01-29 16:38:03 +0000 | [diff] [blame] | 296 | if (_sectionKind == K_SymbolTable) |
| 297 | return llvm::ELF::SHT_SYMTAB; |
| 298 | |
| Shankar Easwaran | 6d9921f | 2013-01-21 20:09:55 +0000 | [diff] [blame] | 299 | switch (_contentType) { |
| 300 | case DefinedAtom::typeCode: |
| 301 | case DefinedAtom::typeData: |
| 302 | case DefinedAtom::typeConstant: |
| Michael J. Spencer | 289dced | 2013-01-29 16:38:03 +0000 | [diff] [blame] | 303 | case DefinedAtom::typeGOT: |
| 304 | case DefinedAtom::typeStub: |
| 305 | case DefinedAtom::typeResolver: |
| Shankar Easwaran | 6d9921f | 2013-01-21 20:09:55 +0000 | [diff] [blame] | 306 | return llvm::ELF::SHT_PROGBITS; |
| 307 | |
| 308 | case DefinedAtom::typeZeroFill: |
| 309 | return llvm::ELF::SHT_NOBITS; |
| 310 | |
| 311 | // Case to handle section types |
| 312 | // Symtab, String Table ... |
| 313 | default: |
| 314 | return _contentType; |
| 315 | } |
| 316 | } |
| 317 | |
| 318 | /// \brief convert the segment type to a String for diagnostics |
| 319 | /// and printing purposes |
| 320 | template<class ELFT> |
| 321 | StringRef |
| 322 | Section<ELFT>::segmentKindToStr() const { |
| 323 | switch(_segmentType) { |
| 324 | case llvm::ELF::PT_INTERP: |
| 325 | return "INTERP"; |
| 326 | case llvm::ELF::PT_LOAD: |
| 327 | return "LOAD"; |
| 328 | case llvm::ELF::PT_GNU_EH_FRAME: |
| 329 | return "EH_FRAME"; |
| 330 | case llvm::ELF::PT_NOTE: |
| 331 | return "NOTE"; |
| 332 | case llvm::ELF::PT_DYNAMIC: |
| 333 | return "DYNAMIC"; |
| 334 | case llvm::ELF::PT_GNU_RELRO: |
| 335 | return "RELRO"; |
| 336 | case llvm::ELF::PT_NULL: |
| 337 | return "NULL"; |
| 338 | default: |
| 339 | return "UNKNOWN"; |
| 340 | } |
| 341 | } |
| 342 | |
| 343 | /// \brief Write the section and the atom contents to the buffer |
| Michael J. Spencer | adfb7eb | 2013-01-29 01:00:21 +0000 | [diff] [blame] | 344 | template <class ELFT> |
| 345 | void Section<ELFT>::write(ELFWriter *writer, llvm::FileOutputBuffer &buffer) { |
| 346 | uint8_t *chunkBuffer = buffer.getBufferStart(); |
| Shankar Easwaran | 6d9921f | 2013-01-21 20:09:55 +0000 | [diff] [blame] | 347 | for (auto &ai : _atoms) { |
| Michael J. Spencer | 289dced | 2013-01-29 16:38:03 +0000 | [diff] [blame] | 348 | DEBUG_WITH_TYPE("Section", |
| Michael J. Spencer | 4260657 | 2013-01-30 01:25:06 +0000 | [diff] [blame] | 349 | llvm::dbgs() << "Writing atom: " << ai->_atom->name() |
| 350 | << " | " << ai->_fileOffset << "\n"); |
| 351 | const DefinedAtom *definedAtom = cast<DefinedAtom>(ai->_atom); |
| Shankar Easwaran | 6d9921f | 2013-01-21 20:09:55 +0000 | [diff] [blame] | 352 | if (definedAtom->contentType() == DefinedAtom::typeZeroFill) |
| 353 | continue; |
| 354 | // Copy raw content of atom to file buffer. |
| 355 | llvm::ArrayRef<uint8_t> content = definedAtom->rawContent(); |
| 356 | uint64_t contentSize = content.size(); |
| 357 | if (contentSize == 0) |
| 358 | continue; |
| Michael J. Spencer | 4260657 | 2013-01-30 01:25:06 +0000 | [diff] [blame] | 359 | uint8_t *atomContent = chunkBuffer + ai->_fileOffset; |
| Shankar Easwaran | 6d9921f | 2013-01-21 20:09:55 +0000 | [diff] [blame] | 360 | std::copy_n(content.data(), contentSize, atomContent); |
| 361 | for (const auto ref : *definedAtom) { |
| 362 | uint32_t offset = ref->offsetInAtom(); |
| 363 | uint64_t targetAddress = 0; |
| 364 | assert(ref->target() != nullptr && "Found the target to be NULL"); |
| 365 | targetAddress = writer->addressOfAtom(ref->target()); |
| Michael J. Spencer | 4260657 | 2013-01-30 01:25:06 +0000 | [diff] [blame] | 366 | uint64_t fixupAddress = writer->addressOfAtom(ai->_atom) + offset; |
| Shankar Easwaran | 6d9921f | 2013-01-21 20:09:55 +0000 | [diff] [blame] | 367 | // apply the relocation |
| 368 | writer->kindHandler()->applyFixup(ref->kind(), |
| 369 | ref->addend(), |
| 370 | &atomContent[offset], |
| 371 | fixupAddress, |
| 372 | targetAddress); |
| 373 | } |
| 374 | } |
| 375 | } |
| 376 | |
| 377 | /// \brief A MergedSections represents a set of sections grouped by the same |
| 378 | /// name. The output file that gets written by the linker has sections grouped |
| 379 | /// by similiar names |
| 380 | template<class ELFT> |
| 381 | class MergedSections { |
| 382 | public: |
| 383 | // Iterators |
| 384 | typedef typename std::vector<Chunk<ELFT> *>::iterator ChunkIter; |
| 385 | |
| Michael J. Spencer | e68f903 | 2013-01-29 22:03:39 +0000 | [diff] [blame] | 386 | MergedSections(StringRef name); |
| Shankar Easwaran | 6d9921f | 2013-01-21 20:09:55 +0000 | [diff] [blame] | 387 | |
| 388 | // Appends a section into the list of sections that are part of this Merged |
| 389 | // Section |
| 390 | void appendSection(Chunk<ELFT> *c); |
| 391 | |
| 392 | // Set the MergedSections is associated with a segment |
| 393 | inline void setHasSegment() { _hasSegment = true; } |
| 394 | |
| 395 | /// Sets the ordinal |
| 396 | inline void setOrdinal(uint64_t ordinal) { |
| 397 | _ordinal = ordinal; |
| 398 | } |
| 399 | |
| 400 | /// Sets the Memory size |
| 401 | inline void setMemSize(uint64_t memsz) { |
| 402 | _memSize = memsz; |
| 403 | } |
| 404 | |
| 405 | /// Sets the size fo the merged Section |
| 406 | inline void setSize(uint64_t fsiz) { |
| 407 | _size = fsiz; |
| 408 | } |
| 409 | |
| 410 | // The offset of the first section contained in the merged section is |
| 411 | // contained here |
| 412 | inline void setFileOffset(uint64_t foffset) { |
| 413 | _fileOffset = foffset; |
| 414 | } |
| 415 | |
| 416 | // Sets the starting address of the section |
| 417 | inline void setAddr(uint64_t addr) { |
| 418 | _virtualAddr = addr; |
| 419 | } |
| 420 | |
| 421 | inline range<ChunkIter> sections() { return _sections; } |
| 422 | |
| 423 | // The below functions returns the properties of the MergeSection |
| 424 | inline bool hasSegment() const { return _hasSegment; } |
| 425 | |
| Michael J. Spencer | e68f903 | 2013-01-29 22:03:39 +0000 | [diff] [blame] | 426 | inline StringRef name() const { return _name; } |
| Shankar Easwaran | 6d9921f | 2013-01-21 20:09:55 +0000 | [diff] [blame] | 427 | |
| 428 | inline int64_t shinfo() const { return _shInfo; } |
| 429 | |
| 430 | inline uint64_t align2() const { return _align2; } |
| 431 | |
| 432 | inline int64_t link() const { return _link; } |
| 433 | |
| 434 | inline int64_t type() const { return _type; } |
| 435 | |
| 436 | inline uint64_t virtualAddr() const { return _virtualAddr; } |
| 437 | |
| 438 | inline int64_t ordinal() const { return _ordinal; } |
| 439 | |
| 440 | inline int64_t kind() const { return _kind; } |
| 441 | |
| 442 | inline uint64_t fileSize() const { return _size; } |
| 443 | |
| 444 | inline int64_t entsize() const { return _entSize; } |
| 445 | |
| 446 | inline uint64_t fileOffset() const { return _fileOffset; } |
| 447 | |
| 448 | inline int64_t flags() const { return _flags; } |
| 449 | |
| 450 | inline uint64_t memSize() { return _memSize; } |
| 451 | |
| 452 | private: |
| Michael J. Spencer | e68f903 | 2013-01-29 22:03:39 +0000 | [diff] [blame] | 453 | StringRef _name; |
| Shankar Easwaran | 6d9921f | 2013-01-21 20:09:55 +0000 | [diff] [blame] | 454 | bool _hasSegment; |
| 455 | uint64_t _ordinal; |
| 456 | int64_t _flags; |
| 457 | uint64_t _size; |
| 458 | uint64_t _memSize; |
| 459 | uint64_t _fileOffset; |
| 460 | uint64_t _virtualAddr; |
| 461 | int64_t _shInfo; |
| 462 | int64_t _entSize; |
| 463 | int64_t _link; |
| 464 | uint64_t _align2; |
| 465 | int64_t _kind; |
| 466 | int64_t _type; |
| 467 | std::vector<Chunk<ELFT> *> _sections; |
| 468 | }; |
| 469 | |
| 470 | /// MergedSections |
| 471 | template<class ELFT> |
| 472 | MergedSections<ELFT>::MergedSections(StringRef name) |
| 473 | : _name(name) |
| 474 | ,_hasSegment(false) |
| 475 | ,_ordinal(0) |
| 476 | ,_flags(0) |
| 477 | ,_size(0) |
| 478 | ,_memSize(0) |
| 479 | ,_fileOffset(0) |
| 480 | ,_virtualAddr(0) |
| 481 | ,_shInfo(0) |
| 482 | ,_entSize(0) |
| 483 | ,_link(0) |
| 484 | ,_align2(0) |
| 485 | ,_kind(0) |
| 486 | ,_type(0) { } |
| 487 | |
| 488 | |
| 489 | template<class ELFT> |
| 490 | void |
| 491 | MergedSections<ELFT>::appendSection(Chunk<ELFT> *c) { |
| 492 | if (c->align2() > _align2) |
| 493 | _align2 = c->align2(); |
| 494 | if (const auto section = dyn_cast<Section<ELFT>>(c)) { |
| 495 | _link = section->link(); |
| 496 | _shInfo = section->shinfo(); |
| 497 | _entSize = section->entsize(); |
| 498 | _type = section->type(); |
| 499 | if (_flags < section->flags()) |
| 500 | _flags = section->flags(); |
| 501 | } |
| 502 | _kind = c->kind(); |
| 503 | _sections.push_back(c); |
| 504 | } |
| 505 | |
| 506 | /// \brief The class represents the ELF String Table |
| 507 | template<class ELFT> |
| Michael J. Spencer | e68f903 | 2013-01-29 22:03:39 +0000 | [diff] [blame] | 508 | class StringTable : public Section<ELFT> { |
| Shankar Easwaran | 6d9921f | 2013-01-21 20:09:55 +0000 | [diff] [blame] | 509 | public: |
| Michael J. Spencer | e68f903 | 2013-01-29 22:03:39 +0000 | [diff] [blame] | 510 | StringTable(const ELFTargetInfo &, const char *str, int32_t order); |
| Shankar Easwaran | 6d9921f | 2013-01-21 20:09:55 +0000 | [diff] [blame] | 511 | |
| 512 | static inline bool classof(const Chunk<ELFT> *c) { |
| 513 | return c->kind() == Section<ELFT>::K_StringTable; |
| 514 | } |
| 515 | |
| Michael J. Spencer | e68f903 | 2013-01-29 22:03:39 +0000 | [diff] [blame] | 516 | uint64_t addString(const StringRef symname); |
| Shankar Easwaran | 6d9921f | 2013-01-21 20:09:55 +0000 | [diff] [blame] | 517 | |
| Michael J. Spencer | adfb7eb | 2013-01-29 01:00:21 +0000 | [diff] [blame] | 518 | void write(ELFWriter *writer, llvm::FileOutputBuffer &buffer); |
| Shankar Easwaran | 6d9921f | 2013-01-21 20:09:55 +0000 | [diff] [blame] | 519 | |
| 520 | inline void finalize() { } |
| 521 | |
| 522 | private: |
| Michael J. Spencer | e68f903 | 2013-01-29 22:03:39 +0000 | [diff] [blame] | 523 | std::vector<StringRef> _strings; |
| Shankar Easwaran | 6d9921f | 2013-01-21 20:09:55 +0000 | [diff] [blame] | 524 | }; |
| 525 | |
| Michael J. Spencer | bf77be3 | 2013-01-29 01:07:47 +0000 | [diff] [blame] | 526 | template <class ELFT> |
| Michael J. Spencer | e68f903 | 2013-01-29 22:03:39 +0000 | [diff] [blame] | 527 | StringTable<ELFT>::StringTable(const ELFTargetInfo &ti, const char *str, |
| Shankar Easwaran | 6d9921f | 2013-01-21 20:09:55 +0000 | [diff] [blame] | 528 | int32_t order) |
| Michael J. Spencer | bf77be3 | 2013-01-29 01:07:47 +0000 | [diff] [blame] | 529 | : Section<ELFT>(ti, str, llvm::ELF::SHT_STRTAB, DefinedAtom::perm___, order, |
| 530 | Section<ELFT>::K_StringTable) { |
| Shankar Easwaran | 6d9921f | 2013-01-21 20:09:55 +0000 | [diff] [blame] | 531 | // the string table has a NULL entry for which |
| 532 | // add an empty string |
| 533 | _strings.push_back(""); |
| 534 | this->_fsize = 1; |
| 535 | this->_align2 = 1; |
| 536 | this->setOrder(order); |
| 537 | } |
| 538 | |
| 539 | template<class ELFT> |
| 540 | uint64_t |
| Michael J. Spencer | e68f903 | 2013-01-29 22:03:39 +0000 | [diff] [blame] | 541 | StringTable<ELFT>::addString(const StringRef symname) { |
| Shankar Easwaran | 6d9921f | 2013-01-21 20:09:55 +0000 | [diff] [blame] | 542 | _strings.push_back(symname); |
| 543 | uint64_t offset = this->_fsize; |
| 544 | this->_fsize += symname.size() + 1; |
| 545 | return offset; |
| 546 | } |
| 547 | |
| Michael J. Spencer | adfb7eb | 2013-01-29 01:00:21 +0000 | [diff] [blame] | 548 | template <class ELFT> |
| Michael J. Spencer | e68f903 | 2013-01-29 22:03:39 +0000 | [diff] [blame] | 549 | void StringTable<ELFT>::write(ELFWriter *writer, |
| Michael J. Spencer | adfb7eb | 2013-01-29 01:00:21 +0000 | [diff] [blame] | 550 | llvm::FileOutputBuffer &buffer) { |
| 551 | uint8_t *chunkBuffer = buffer.getBufferStart(); |
| Shankar Easwaran | 6d9921f | 2013-01-21 20:09:55 +0000 | [diff] [blame] | 552 | uint8_t *dest = chunkBuffer + this->fileOffset(); |
| 553 | for (auto si : _strings) { |
| 554 | memcpy(dest, si.data(), si.size()); |
| 555 | dest += si.size(); |
| 556 | memcpy(dest, "", 1); |
| 557 | dest += 1; |
| 558 | } |
| 559 | } |
| 560 | |
| Michael J. Spencer | e68f903 | 2013-01-29 22:03:39 +0000 | [diff] [blame] | 561 | /// \brief The SymbolTable class represents the symbol table in a ELF file |
| Shankar Easwaran | 6d9921f | 2013-01-21 20:09:55 +0000 | [diff] [blame] | 562 | template<class ELFT> |
| Michael J. Spencer | e68f903 | 2013-01-29 22:03:39 +0000 | [diff] [blame] | 563 | class SymbolTable : public Section<ELFT> { |
| Shankar Easwaran | 6d9921f | 2013-01-21 20:09:55 +0000 | [diff] [blame] | 564 | public: |
| 565 | typedef llvm::object::Elf_Sym_Impl<ELFT> Elf_Sym; |
| 566 | |
| Michael J. Spencer | e68f903 | 2013-01-29 22:03:39 +0000 | [diff] [blame] | 567 | SymbolTable(const ELFTargetInfo &ti, const char *str, int32_t order); |
| Shankar Easwaran | 6d9921f | 2013-01-21 20:09:55 +0000 | [diff] [blame] | 568 | |
| 569 | void addSymbol(const Atom *atom, int32_t sectionIndex, uint64_t addr = 0); |
| 570 | |
| 571 | void finalize(); |
| 572 | |
| Michael J. Spencer | adfb7eb | 2013-01-29 01:00:21 +0000 | [diff] [blame] | 573 | void write(ELFWriter *writer, llvm::FileOutputBuffer &buffer); |
| Shankar Easwaran | 6d9921f | 2013-01-21 20:09:55 +0000 | [diff] [blame] | 574 | |
| 575 | static inline bool classof(const Chunk<ELFT> *c) { |
| 576 | return c->kind() == Section<ELFT>::K_SymbolTable; |
| 577 | } |
| 578 | |
| Michael J. Spencer | e68f903 | 2013-01-29 22:03:39 +0000 | [diff] [blame] | 579 | inline void setStringSection(StringTable<ELFT> *s) { |
| Shankar Easwaran | 6d9921f | 2013-01-21 20:09:55 +0000 | [diff] [blame] | 580 | _stringSection = s; |
| 581 | } |
| 582 | |
| 583 | private: |
| Michael J. Spencer | e68f903 | 2013-01-29 22:03:39 +0000 | [diff] [blame] | 584 | StringTable<ELFT> *_stringSection; |
| Shankar Easwaran | 6d9921f | 2013-01-21 20:09:55 +0000 | [diff] [blame] | 585 | std::vector<Elf_Sym*> _symbolTable; |
| 586 | llvm::BumpPtrAllocator _symbolAllocate; |
| 587 | int64_t _link; |
| 588 | }; |
| 589 | |
| 590 | /// ELF Symbol Table |
| Michael J. Spencer | bf77be3 | 2013-01-29 01:07:47 +0000 | [diff] [blame] | 591 | template <class ELFT> |
| Michael J. Spencer | e68f903 | 2013-01-29 22:03:39 +0000 | [diff] [blame] | 592 | SymbolTable<ELFT>::SymbolTable(const ELFTargetInfo &ti, const char *str, |
| Shankar Easwaran | 6d9921f | 2013-01-21 20:09:55 +0000 | [diff] [blame] | 593 | int32_t order) |
| Michael J. Spencer | bf77be3 | 2013-01-29 01:07:47 +0000 | [diff] [blame] | 594 | : Section<ELFT>(ti, str, llvm::ELF::SHT_SYMTAB, 0, order, |
| 595 | Section<ELFT>::K_SymbolTable) { |
| Shankar Easwaran | 6d9921f | 2013-01-21 20:09:55 +0000 | [diff] [blame] | 596 | this->setOrder(order); |
| 597 | Elf_Sym *symbol = new (_symbolAllocate.Allocate<Elf_Sym>()) Elf_Sym; |
| 598 | memset((void *)symbol, 0, sizeof(Elf_Sym)); |
| 599 | _symbolTable.push_back(symbol); |
| 600 | this->_entSize = sizeof(Elf_Sym); |
| 601 | this->_fsize = sizeof(Elf_Sym); |
| 602 | this->_align2 = sizeof(void *); |
| 603 | } |
| 604 | |
| 605 | template<class ELFT> |
| 606 | void |
| Michael J. Spencer | e68f903 | 2013-01-29 22:03:39 +0000 | [diff] [blame] | 607 | SymbolTable<ELFT>::addSymbol(const Atom *atom, |
| Shankar Easwaran | 6d9921f | 2013-01-21 20:09:55 +0000 | [diff] [blame] | 608 | int32_t sectionIndex, |
| 609 | uint64_t addr) { |
| 610 | Elf_Sym *symbol = new(_symbolAllocate.Allocate<Elf_Sym>()) Elf_Sym; |
| 611 | unsigned char binding = 0, type = 0; |
| 612 | symbol->st_name = _stringSection->addString(atom->name()); |
| 613 | symbol->st_size = 0; |
| 614 | symbol->st_shndx = sectionIndex; |
| 615 | symbol->st_value = 0; |
| 616 | symbol->st_other = llvm::ELF::STV_DEFAULT; |
| 617 | if (const DefinedAtom *da = dyn_cast<const DefinedAtom>(atom)){ |
| 618 | symbol->st_size = da->size(); |
| Michael J. Spencer | e68f903 | 2013-01-29 22:03:39 +0000 | [diff] [blame] | 619 | DefinedAtom::ContentType ct; |
| Shankar Easwaran | 6d9921f | 2013-01-21 20:09:55 +0000 | [diff] [blame] | 620 | switch (ct = da->contentType()){ |
| Michael J. Spencer | e68f903 | 2013-01-29 22:03:39 +0000 | [diff] [blame] | 621 | case DefinedAtom::typeCode: |
| Michael J. Spencer | 289dced | 2013-01-29 16:38:03 +0000 | [diff] [blame] | 622 | case DefinedAtom::typeStub: |
| Shankar Easwaran | 6d9921f | 2013-01-21 20:09:55 +0000 | [diff] [blame] | 623 | symbol->st_value = addr; |
| 624 | type = llvm::ELF::STT_FUNC; |
| 625 | break; |
| Michael J. Spencer | 289dced | 2013-01-29 16:38:03 +0000 | [diff] [blame] | 626 | case DefinedAtom::typeResolver: |
| 627 | symbol->st_value = addr; |
| 628 | type = llvm::ELF::STT_GNU_IFUNC; |
| 629 | break; |
| Michael J. Spencer | e68f903 | 2013-01-29 22:03:39 +0000 | [diff] [blame] | 630 | case DefinedAtom::typeData: |
| 631 | case DefinedAtom::typeConstant: |
| Michael J. Spencer | 289dced | 2013-01-29 16:38:03 +0000 | [diff] [blame] | 632 | case DefinedAtom::typeGOT: |
| Shankar Easwaran | 6d9921f | 2013-01-21 20:09:55 +0000 | [diff] [blame] | 633 | symbol->st_value = addr; |
| 634 | type = llvm::ELF::STT_OBJECT; |
| 635 | break; |
| Michael J. Spencer | e68f903 | 2013-01-29 22:03:39 +0000 | [diff] [blame] | 636 | case DefinedAtom::typeZeroFill: |
| Shankar Easwaran | 6d9921f | 2013-01-21 20:09:55 +0000 | [diff] [blame] | 637 | type = llvm::ELF::STT_OBJECT; |
| 638 | symbol->st_value = addr; |
| 639 | break; |
| 640 | default: |
| 641 | type = llvm::ELF::STT_NOTYPE; |
| 642 | } |
| 643 | if (da->scope() == DefinedAtom::scopeTranslationUnit) |
| 644 | binding = llvm::ELF::STB_LOCAL; |
| 645 | else |
| 646 | binding = llvm::ELF::STB_GLOBAL; |
| 647 | } else if (const AbsoluteAtom *aa = dyn_cast<const AbsoluteAtom>(atom)){ |
| 648 | type = llvm::ELF::STT_OBJECT; |
| 649 | symbol->st_shndx = llvm::ELF::SHN_ABS; |
| 650 | switch (aa->scope()) { |
| 651 | case AbsoluteAtom::scopeLinkageUnit: |
| 652 | symbol->st_other = llvm::ELF::STV_HIDDEN; |
| 653 | binding = llvm::ELF::STB_LOCAL; |
| 654 | break; |
| 655 | case AbsoluteAtom::scopeTranslationUnit: |
| 656 | binding = llvm::ELF::STB_LOCAL; |
| 657 | break; |
| 658 | case AbsoluteAtom::scopeGlobal: |
| 659 | binding = llvm::ELF::STB_GLOBAL; |
| 660 | break; |
| 661 | } |
| 662 | symbol->st_value = addr; |
| 663 | } else { |
| 664 | symbol->st_value = 0; |
| 665 | type = llvm::ELF::STT_NOTYPE; |
| 666 | binding = llvm::ELF::STB_WEAK; |
| 667 | } |
| 668 | symbol->setBindingAndType(binding, type); |
| 669 | _symbolTable.push_back(symbol); |
| 670 | this->_fsize += sizeof(Elf_Sym); |
| 671 | } |
| 672 | |
| 673 | template<class ELFT> |
| 674 | void |
| Michael J. Spencer | e68f903 | 2013-01-29 22:03:39 +0000 | [diff] [blame] | 675 | SymbolTable<ELFT>::finalize() { |
| Shankar Easwaran | 6d9921f | 2013-01-21 20:09:55 +0000 | [diff] [blame] | 676 | // sh_info should be one greater than last symbol with STB_LOCAL binding |
| 677 | // we sort the symbol table to keep all local symbols at the beginning |
| 678 | std::stable_sort(_symbolTable.begin(), _symbolTable.end(), |
| 679 | [](const Elf_Sym *A, const Elf_Sym *B) { |
| 680 | return A->getBinding() < B->getBinding(); |
| 681 | }); |
| 682 | uint16_t shInfo = 0; |
| 683 | for (auto i : _symbolTable) { |
| 684 | if (i->getBinding() != llvm::ELF::STB_LOCAL) |
| 685 | break; |
| 686 | shInfo++; |
| 687 | } |
| 688 | this->_shInfo = shInfo; |
| 689 | this->setLink(_stringSection->ordinal()); |
| 690 | } |
| 691 | |
| Michael J. Spencer | adfb7eb | 2013-01-29 01:00:21 +0000 | [diff] [blame] | 692 | template <class ELFT> |
| Michael J. Spencer | e68f903 | 2013-01-29 22:03:39 +0000 | [diff] [blame] | 693 | void SymbolTable<ELFT>::write(ELFWriter *writer, |
| Michael J. Spencer | adfb7eb | 2013-01-29 01:00:21 +0000 | [diff] [blame] | 694 | llvm::FileOutputBuffer &buffer) { |
| 695 | uint8_t *chunkBuffer = buffer.getBufferStart(); |
| Shankar Easwaran | 6d9921f | 2013-01-21 20:09:55 +0000 | [diff] [blame] | 696 | uint8_t *dest = chunkBuffer + this->fileOffset(); |
| 697 | for (auto sti : _symbolTable) { |
| 698 | memcpy(dest, sti, sizeof(Elf_Sym)); |
| 699 | dest += sizeof(Elf_Sym); |
| 700 | } |
| 701 | } |
| 702 | |
| Michael J. Spencer | e68f903 | 2013-01-29 22:03:39 +0000 | [diff] [blame] | 703 | template <class ELFT> class RelocationTable : public Section<ELFT> { |
| Michael J. Spencer | 289dced | 2013-01-29 16:38:03 +0000 | [diff] [blame] | 704 | public: |
| 705 | typedef llvm::object::Elf_Rel_Impl<ELFT, true> Elf_Rela; |
| 706 | |
| Michael J. Spencer | e68f903 | 2013-01-29 22:03:39 +0000 | [diff] [blame] | 707 | RelocationTable(const ELFTargetInfo &ti, StringRef str, int32_t order) |
| Michael J. Spencer | 289dced | 2013-01-29 16:38:03 +0000 | [diff] [blame] | 708 | : Section<ELFT>(ti, str, llvm::ELF::SHT_RELA, DefinedAtom::permR__, order, |
| 709 | Section<ELFT>::K_Default) { |
| 710 | this->setOrder(order); |
| 711 | this->_entSize = sizeof(Elf_Rela); |
| 712 | this->_align2 = llvm::alignOf<Elf_Rela>(); |
| 713 | } |
| 714 | |
| 715 | void addRelocation(const DefinedAtom &da, const Reference &r) { |
| 716 | _relocs.emplace_back(da, r); |
| 717 | this->_fsize = _relocs.size() * sizeof(Elf_Rela); |
| 718 | this->_msize = this->_fsize; |
| 719 | } |
| 720 | |
| 721 | void write(ELFWriter *writer, llvm::FileOutputBuffer &buffer) { |
| 722 | uint8_t *chunkBuffer = buffer.getBufferStart(); |
| 723 | uint8_t *dest = chunkBuffer + this->fileOffset(); |
| 724 | for (const auto &rel : _relocs) { |
| 725 | Elf_Rela *r = reinterpret_cast<Elf_Rela *>(dest); |
| 726 | r->setSymbolAndType(0, rel.second.kind()); |
| 727 | r->r_offset = |
| 728 | writer->addressOfAtom(&rel.first) + rel.second.offsetInAtom(); |
| 729 | r->r_addend = |
| 730 | writer->addressOfAtom(rel.second.target()) + rel.second.addend(); |
| 731 | dest += sizeof(Elf_Rela); |
| 732 | DEBUG_WITH_TYPE("ELFRelocationTable", llvm::dbgs() |
| 733 | << "IRELATIVE relocation at " << rel.first.name() << "@" |
| 734 | << r->r_offset << " to " << rel.second.target()->name() |
| 735 | << "@" << r->r_addend << "\n"); |
| 736 | } |
| 737 | } |
| 738 | |
| 739 | private: |
| 740 | std::vector<std::pair<const DefinedAtom &, const Reference &>> _relocs; |
| 741 | }; |
| Michael J. Spencer | e68f903 | 2013-01-29 22:03:39 +0000 | [diff] [blame] | 742 | } // end namespace elf |
| 743 | } // end namespace lld |
| Michael J. Spencer | 289dced | 2013-01-29 16:38:03 +0000 | [diff] [blame] | 744 | |
| Michael J. Spencer | e68f903 | 2013-01-29 22:03:39 +0000 | [diff] [blame] | 745 | #endif |