Rafael Espindola | 5805c4f | 2015-09-21 21:38:08 +0000 | [diff] [blame] | 1 | //===- OutputSections.h -----------------------------------------*- C++ -*-===// |
| 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 | |
| 10 | #ifndef LLD_ELF_OUTPUT_SECTIONS_H |
| 11 | #define LLD_ELF_OUTPUT_SECTIONS_H |
| 12 | |
Davide Italiano | 85121bb | 2015-09-25 03:56:11 +0000 | [diff] [blame] | 13 | #include "Config.h" |
Simon Atanasyan | 4132511 | 2016-06-19 21:39:37 +0000 | [diff] [blame] | 14 | #include "Relocations.h" |
Davide Italiano | 85121bb | 2015-09-25 03:56:11 +0000 | [diff] [blame] | 15 | |
Rui Ueyama | a0752a5 | 2016-03-13 20:28:29 +0000 | [diff] [blame] | 16 | #include "lld/Core/LLVM.h" |
Simon Atanasyan | d2980d3 | 2016-03-29 14:07:22 +0000 | [diff] [blame] | 17 | #include "llvm/ADT/SmallPtrSet.h" |
Rui Ueyama | a0752a5 | 2016-03-13 20:28:29 +0000 | [diff] [blame] | 18 | #include "llvm/MC/StringTableBuilder.h" |
| 19 | #include "llvm/Object/ELF.h" |
Rui Ueyama | 3a41be2 | 2016-04-07 22:49:21 +0000 | [diff] [blame] | 20 | #include "llvm/Support/MD5.h" |
Rui Ueyama | d86ec30 | 2016-04-07 23:51:56 +0000 | [diff] [blame] | 21 | #include "llvm/Support/SHA1.h" |
Rafael Espindola | 5805c4f | 2015-09-21 21:38:08 +0000 | [diff] [blame] | 22 | |
| 23 | namespace lld { |
Rafael Espindola | e0df00b | 2016-02-28 00:25:54 +0000 | [diff] [blame] | 24 | namespace elf { |
Rafael Espindola | 5805c4f | 2015-09-21 21:38:08 +0000 | [diff] [blame] | 25 | |
| 26 | class SymbolBody; |
Rui Ueyama | f8b285c | 2016-05-22 23:16:14 +0000 | [diff] [blame] | 27 | struct SectionPiece; |
George Rimar | d356630 | 2016-06-20 11:55:12 +0000 | [diff] [blame] | 28 | struct Version; |
Rui Ueyama | 3ce825e | 2015-10-09 21:07:25 +0000 | [diff] [blame] | 29 | template <class ELFT> class SymbolTable; |
Rafael Espindola | 5805c4f | 2015-09-21 21:38:08 +0000 | [diff] [blame] | 30 | template <class ELFT> class SymbolTableSection; |
Rui Ueyama | c7cc6ec | 2015-10-15 22:27:29 +0000 | [diff] [blame] | 31 | template <class ELFT> class StringTableSection; |
Rui Ueyama | 0b9a903 | 2016-05-24 04:19:20 +0000 | [diff] [blame] | 32 | template <class ELFT> class EhInputSection; |
Rafael Espindola | 5805c4f | 2015-09-21 21:38:08 +0000 | [diff] [blame] | 33 | template <class ELFT> class InputSection; |
Rafael Espindola | 0c6a4f1 | 2015-11-11 19:54:14 +0000 | [diff] [blame] | 34 | template <class ELFT> class InputSectionBase; |
Rafael Espindola | c159c96 | 2015-10-19 21:00:02 +0000 | [diff] [blame] | 35 | template <class ELFT> class MergeInputSection; |
Simon Atanasyan | 1d7df40 | 2015-12-20 10:57:34 +0000 | [diff] [blame] | 36 | template <class ELFT> class MipsReginfoInputSection; |
Rafael Espindola | 5805c4f | 2015-09-21 21:38:08 +0000 | [diff] [blame] | 37 | template <class ELFT> class OutputSection; |
| 38 | template <class ELFT> class ObjectFile; |
Peter Collingbourne | 21a12fc | 2016-04-27 20:22:31 +0000 | [diff] [blame] | 39 | template <class ELFT> class SharedFile; |
| 40 | template <class ELFT> class SharedSymbol; |
Rafael Espindola | 5805c4f | 2015-09-21 21:38:08 +0000 | [diff] [blame] | 41 | template <class ELFT> class DefinedRegular; |
| 42 | |
Rafael Espindola | 5805c4f | 2015-09-21 21:38:08 +0000 | [diff] [blame] | 43 | template <class ELFT> |
Rui Ueyama | 9328b2c | 2016-03-14 23:16:09 +0000 | [diff] [blame] | 44 | static inline typename ELFT::uint getAddend(const typename ELFT::Rel &Rel) { |
Rafael Espindola | 932efcf | 2015-10-19 20:24:44 +0000 | [diff] [blame] | 45 | return 0; |
| 46 | } |
Rafael Espindola | 5805c4f | 2015-09-21 21:38:08 +0000 | [diff] [blame] | 47 | |
| 48 | template <class ELFT> |
Rui Ueyama | 9328b2c | 2016-03-14 23:16:09 +0000 | [diff] [blame] | 49 | static inline typename ELFT::uint getAddend(const typename ELFT::Rela &Rel) { |
Rafael Espindola | 932efcf | 2015-10-19 20:24:44 +0000 | [diff] [blame] | 50 | return Rel.r_addend; |
| 51 | } |
| 52 | |
George Rimar | 12737b7 | 2016-02-25 08:40:26 +0000 | [diff] [blame] | 53 | bool isValidCIdentifier(StringRef S); |
| 54 | |
Rafael Espindola | 7167585 | 2015-09-22 00:16:19 +0000 | [diff] [blame] | 55 | // This represents a section in an output file. |
| 56 | // Different sub classes represent different types of sections. Some contain |
| 57 | // input sections, others are created by the linker. |
| 58 | // The writer creates multiple OutputSections and assign them unique, |
Rafael Espindola | 5805c4f | 2015-09-21 21:38:08 +0000 | [diff] [blame] | 59 | // non-overlapping file offsets and VAs. |
Rui Ueyama | c7cc6ec | 2015-10-15 22:27:29 +0000 | [diff] [blame] | 60 | template <class ELFT> class OutputSectionBase { |
Rafael Espindola | 5805c4f | 2015-09-21 21:38:08 +0000 | [diff] [blame] | 61 | public: |
Rui Ueyama | 9328b2c | 2016-03-14 23:16:09 +0000 | [diff] [blame] | 62 | typedef typename ELFT::uint uintX_t; |
| 63 | typedef typename ELFT::Shdr Elf_Shdr; |
Rafael Espindola | 5805c4f | 2015-09-21 21:38:08 +0000 | [diff] [blame] | 64 | |
George Rimar | 9bec24a | 2016-02-18 14:20:08 +0000 | [diff] [blame] | 65 | OutputSectionBase(StringRef Name, uint32_t Type, uintX_t Flags); |
Rafael Espindola | 5805c4f | 2015-09-21 21:38:08 +0000 | [diff] [blame] | 66 | void setVA(uintX_t VA) { Header.sh_addr = VA; } |
| 67 | uintX_t getVA() const { return Header.sh_addr; } |
| 68 | void setFileOffset(uintX_t Off) { Header.sh_offset = Off; } |
Rafael Espindola | e2c2461 | 2016-01-29 01:24:25 +0000 | [diff] [blame] | 69 | void setSHName(unsigned Val) { Header.sh_name = Val; } |
Rui Ueyama | c7cc6ec | 2015-10-15 22:27:29 +0000 | [diff] [blame] | 70 | void writeHeaderTo(Elf_Shdr *SHdr); |
Rafael Espindola | 5805c4f | 2015-09-21 21:38:08 +0000 | [diff] [blame] | 71 | StringRef getName() { return Name; } |
Rafael Espindola | 5805c4f | 2015-09-21 21:38:08 +0000 | [diff] [blame] | 72 | |
Rui Ueyama | 40845e6 | 2015-12-26 05:51:07 +0000 | [diff] [blame] | 73 | virtual void addSection(InputSectionBase<ELFT> *C) {} |
| 74 | |
Rui Ueyama | 2317d0d | 2015-10-15 20:55:22 +0000 | [diff] [blame] | 75 | unsigned SectionIndex; |
Rafael Espindola | 5805c4f | 2015-09-21 21:38:08 +0000 | [diff] [blame] | 76 | |
| 77 | // Returns the size of the section in the output file. |
Rafael Espindola | 7757224 | 2015-10-02 19:37:55 +0000 | [diff] [blame] | 78 | uintX_t getSize() const { return Header.sh_size; } |
Rafael Espindola | 5805c4f | 2015-09-21 21:38:08 +0000 | [diff] [blame] | 79 | void setSize(uintX_t Val) { Header.sh_size = Val; } |
Rafael Espindola | 571452c | 2016-04-11 13:44:05 +0000 | [diff] [blame] | 80 | uintX_t getFlags() const { return Header.sh_flags; } |
| 81 | uintX_t getFileOff() const { return Header.sh_offset; } |
Rui Ueyama | 424b408 | 2016-06-17 01:18:46 +0000 | [diff] [blame] | 82 | uintX_t getAlignment() const { |
Rafael Espindola | 5805c4f | 2015-09-21 21:38:08 +0000 | [diff] [blame] | 83 | // The ELF spec states that a value of 0 means the section has no alignment |
| 84 | // constraits. |
| 85 | return std::max<uintX_t>(Header.sh_addralign, 1); |
| 86 | } |
Rafael Espindola | 571452c | 2016-04-11 13:44:05 +0000 | [diff] [blame] | 87 | uint32_t getType() const { return Header.sh_type; } |
Rui Ueyama | 424b408 | 2016-06-17 01:18:46 +0000 | [diff] [blame] | 88 | void updateAlignment(uintX_t Alignment) { |
| 89 | if (Alignment > Header.sh_addralign) |
| 90 | Header.sh_addralign = Alignment; |
Rafael Espindola | 115f0f3 | 2015-11-03 14:13:40 +0000 | [diff] [blame] | 91 | } |
Rafael Espindola | 5805c4f | 2015-09-21 21:38:08 +0000 | [diff] [blame] | 92 | |
Rui Ueyama | 4709190 | 2016-03-30 19:41:51 +0000 | [diff] [blame] | 93 | // If true, this section will be page aligned on disk. |
| 94 | // Typically the first section of each PT_LOAD segment has this flag. |
| 95 | bool PageAlign = false; |
| 96 | |
Rafael Espindola | 5805c4f | 2015-09-21 21:38:08 +0000 | [diff] [blame] | 97 | virtual void finalize() {} |
Rui Ueyama | 406b469 | 2016-05-27 14:39:13 +0000 | [diff] [blame] | 98 | virtual void finalizePieces() {} |
Rui Ueyama | 809d8e2 | 2016-06-23 04:33:42 +0000 | [diff] [blame] | 99 | virtual void assignOffsets() {} |
Rafael Espindola | 4fc6044 | 2016-02-10 22:43:13 +0000 | [diff] [blame] | 100 | virtual void writeTo(uint8_t *Buf) {} |
Rui Ueyama | d4ea7dd | 2015-12-26 07:01:26 +0000 | [diff] [blame] | 101 | virtual ~OutputSectionBase() = default; |
Rafael Espindola | 5805c4f | 2015-09-21 21:38:08 +0000 | [diff] [blame] | 102 | |
| 103 | protected: |
| 104 | StringRef Name; |
Sean Silva | 580c1b6 | 2016-04-20 04:26:16 +0000 | [diff] [blame] | 105 | Elf_Shdr Header; |
Rafael Espindola | 5805c4f | 2015-09-21 21:38:08 +0000 | [diff] [blame] | 106 | }; |
| 107 | |
Rui Ueyama | c7cc6ec | 2015-10-15 22:27:29 +0000 | [diff] [blame] | 108 | template <class ELFT> class GotSection final : public OutputSectionBase<ELFT> { |
| 109 | typedef OutputSectionBase<ELFT> Base; |
Rui Ueyama | 9328b2c | 2016-03-14 23:16:09 +0000 | [diff] [blame] | 110 | typedef typename ELFT::uint uintX_t; |
Rafael Espindola | 5805c4f | 2015-09-21 21:38:08 +0000 | [diff] [blame] | 111 | |
| 112 | public: |
Rui Ueyama | 15ef5e1 | 2015-10-07 19:18:16 +0000 | [diff] [blame] | 113 | GotSection(); |
Igor Kudrin | 15cd9ff | 2015-11-06 07:43:03 +0000 | [diff] [blame] | 114 | void finalize() override; |
Rafael Espindola | a662738 | 2015-10-06 23:56:53 +0000 | [diff] [blame] | 115 | void writeTo(uint8_t *Buf) override; |
Rafael Espindola | 67d72c0 | 2016-03-11 12:06:30 +0000 | [diff] [blame] | 116 | void addEntry(SymbolBody &Sym); |
Simon Atanasyan | 4132511 | 2016-06-19 21:39:37 +0000 | [diff] [blame] | 117 | void addMipsEntry(SymbolBody &Sym, uintX_t Addend, RelExpr Expr); |
Rafael Espindola | 67d72c0 | 2016-03-11 12:06:30 +0000 | [diff] [blame] | 118 | bool addDynTlsEntry(SymbolBody &Sym); |
Rui Ueyama | 0e53c7d | 2016-02-05 00:10:02 +0000 | [diff] [blame] | 119 | bool addTlsIndex(); |
Simon Atanasyan | 4132511 | 2016-06-19 21:39:37 +0000 | [diff] [blame] | 120 | bool empty() const { return MipsPageEntries == 0 && Entries.empty(); } |
Rafael Espindola | 58cd5db | 2016-04-19 22:46:03 +0000 | [diff] [blame] | 121 | uintX_t getMipsLocalPageOffset(uintX_t Addr); |
Simon Atanasyan | 4132511 | 2016-06-19 21:39:37 +0000 | [diff] [blame] | 122 | uintX_t getMipsGotOffset(const SymbolBody &B, uintX_t Addend) const; |
George Rimar | 90cd0a8 | 2015-12-01 19:20:26 +0000 | [diff] [blame] | 123 | uintX_t getGlobalDynAddr(const SymbolBody &B) const; |
Rafael Espindola | 74031ba | 2016-04-07 15:20:56 +0000 | [diff] [blame] | 124 | uintX_t getGlobalDynOffset(const SymbolBody &B) const; |
George Rimar | 9db204a | 2015-12-02 09:58:20 +0000 | [diff] [blame] | 125 | uintX_t getNumEntries() const { return Entries.size(); } |
Rafael Espindola | 5805c4f | 2015-09-21 21:38:08 +0000 | [diff] [blame] | 126 | |
Igor Kudrin | 304860a | 2015-11-12 04:39:49 +0000 | [diff] [blame] | 127 | // Returns the symbol which corresponds to the first entry of the global part |
| 128 | // of GOT on MIPS platform. It is required to fill up MIPS-specific dynamic |
| 129 | // table properties. |
| 130 | // Returns nullptr if the global part is empty. |
| 131 | const SymbolBody *getMipsFirstGlobalEntry() const; |
| 132 | |
| 133 | // Returns the number of entries in the local part of GOT including |
| 134 | // the number of reserved entries. This method is MIPS-specific. |
| 135 | unsigned getMipsLocalEntriesNum() const; |
| 136 | |
Simon Atanasyan | 002e244 | 2016-06-23 15:26:31 +0000 | [diff] [blame^] | 137 | // Returns offset of TLS part of the MIPS GOT table. This part goes |
| 138 | // after 'local' and 'global' entries. |
| 139 | uintX_t getMipsTlsOffset(); |
| 140 | |
Rui Ueyama | 0e53c7d | 2016-02-05 00:10:02 +0000 | [diff] [blame] | 141 | uintX_t getTlsIndexVA() { return Base::getVA() + TlsIndexOff; } |
Rafael Espindola | 74031ba | 2016-04-07 15:20:56 +0000 | [diff] [blame] | 142 | uint32_t getTlsIndexOff() { return TlsIndexOff; } |
George Rimar | b17f739 | 2015-12-01 18:24:07 +0000 | [diff] [blame] | 143 | |
Rui Ueyama | 022d8e8 | 2016-05-24 03:36:07 +0000 | [diff] [blame] | 144 | // Flag to force GOT to be in output if we have relocations |
| 145 | // that relies on its address. |
| 146 | bool HasGotOffRel = false; |
| 147 | |
Rafael Espindola | 5805c4f | 2015-09-21 21:38:08 +0000 | [diff] [blame] | 148 | private: |
| 149 | std::vector<const SymbolBody *> Entries; |
Rui Ueyama | 0e53c7d | 2016-02-05 00:10:02 +0000 | [diff] [blame] | 150 | uint32_t TlsIndexOff = -1; |
Simon Atanasyan | 4132511 | 2016-06-19 21:39:37 +0000 | [diff] [blame] | 151 | uint32_t MipsPageEntries = 0; |
Simon Atanasyan | d2980d3 | 2016-03-29 14:07:22 +0000 | [diff] [blame] | 152 | // Output sections referenced by MIPS GOT relocations. |
| 153 | llvm::SmallPtrSet<const OutputSectionBase<ELFT> *, 10> MipsOutSections; |
Simon Atanasyan | 56ab5f0 | 2016-01-21 05:33:23 +0000 | [diff] [blame] | 154 | llvm::DenseMap<uintX_t, size_t> MipsLocalGotPos; |
Simon Atanasyan | 4132511 | 2016-06-19 21:39:37 +0000 | [diff] [blame] | 155 | |
| 156 | // MIPS ABI requires to create unique GOT entry for each Symbol/Addend |
| 157 | // pairs. The `MipsGotMap` maps (S,A) pair to the GOT index in the `MipsLocal` |
| 158 | // or `MipsGlobal` vectors. In general it does not have a sence to take in |
| 159 | // account addend for preemptible symbols because the corresponding |
| 160 | // GOT entries should have one-to-one mapping with dynamic symbols table. |
| 161 | // But we use the same container's types for both kind of GOT entries |
| 162 | // to handle them uniformly. |
| 163 | typedef std::pair<const SymbolBody*, uintX_t> MipsGotEntry; |
| 164 | typedef std::vector<MipsGotEntry> MipsGotEntries; |
| 165 | llvm::DenseMap<MipsGotEntry, size_t> MipsGotMap; |
| 166 | MipsGotEntries MipsLocal; |
| 167 | MipsGotEntries MipsGlobal; |
| 168 | |
| 169 | // Write MIPS-specific parts of the GOT. |
| 170 | void writeMipsGot(uint8_t *&Buf); |
Rafael Espindola | 5805c4f | 2015-09-21 21:38:08 +0000 | [diff] [blame] | 171 | }; |
| 172 | |
George Rimar | 648a2c3 | 2015-10-20 08:54:27 +0000 | [diff] [blame] | 173 | template <class ELFT> |
| 174 | class GotPltSection final : public OutputSectionBase<ELFT> { |
Rui Ueyama | 9328b2c | 2016-03-14 23:16:09 +0000 | [diff] [blame] | 175 | typedef typename ELFT::uint uintX_t; |
George Rimar | 648a2c3 | 2015-10-20 08:54:27 +0000 | [diff] [blame] | 176 | |
| 177 | public: |
| 178 | GotPltSection(); |
| 179 | void finalize() override; |
| 180 | void writeTo(uint8_t *Buf) override; |
Rafael Espindola | 67d72c0 | 2016-03-11 12:06:30 +0000 | [diff] [blame] | 181 | void addEntry(SymbolBody &Sym); |
George Rimar | 648a2c3 | 2015-10-20 08:54:27 +0000 | [diff] [blame] | 182 | bool empty() const; |
George Rimar | 648a2c3 | 2015-10-20 08:54:27 +0000 | [diff] [blame] | 183 | |
| 184 | private: |
| 185 | std::vector<const SymbolBody *> Entries; |
| 186 | }; |
| 187 | |
Rui Ueyama | c7cc6ec | 2015-10-15 22:27:29 +0000 | [diff] [blame] | 188 | template <class ELFT> class PltSection final : public OutputSectionBase<ELFT> { |
| 189 | typedef OutputSectionBase<ELFT> Base; |
Rui Ueyama | 9328b2c | 2016-03-14 23:16:09 +0000 | [diff] [blame] | 190 | typedef typename ELFT::uint uintX_t; |
Rafael Espindola | 5805c4f | 2015-09-21 21:38:08 +0000 | [diff] [blame] | 191 | |
| 192 | public: |
Rui Ueyama | 15ef5e1 | 2015-10-07 19:18:16 +0000 | [diff] [blame] | 193 | PltSection(); |
Hal Finkel | 6c2a3b8 | 2015-10-08 21:51:31 +0000 | [diff] [blame] | 194 | void finalize() override; |
Rafael Espindola | 5805c4f | 2015-09-21 21:38:08 +0000 | [diff] [blame] | 195 | void writeTo(uint8_t *Buf) override; |
Rafael Espindola | 67d72c0 | 2016-03-11 12:06:30 +0000 | [diff] [blame] | 196 | void addEntry(SymbolBody &Sym); |
Rafael Espindola | 5805c4f | 2015-09-21 21:38:08 +0000 | [diff] [blame] | 197 | bool empty() const { return Entries.empty(); } |
Rafael Espindola | 5805c4f | 2015-09-21 21:38:08 +0000 | [diff] [blame] | 198 | |
| 199 | private: |
George Rimar | 77b7779 | 2015-11-25 22:15:01 +0000 | [diff] [blame] | 200 | std::vector<std::pair<const SymbolBody *, unsigned>> Entries; |
Rafael Espindola | 5805c4f | 2015-09-21 21:38:08 +0000 | [diff] [blame] | 201 | }; |
| 202 | |
Rui Ueyama | 809d8e2 | 2016-06-23 04:33:42 +0000 | [diff] [blame] | 203 | template <class ELFT> class DynamicReloc { |
Rui Ueyama | 9328b2c | 2016-03-14 23:16:09 +0000 | [diff] [blame] | 204 | typedef typename ELFT::uint uintX_t; |
Rui Ueyama | 809d8e2 | 2016-06-23 04:33:42 +0000 | [diff] [blame] | 205 | |
| 206 | public: |
| 207 | DynamicReloc(uint32_t Type, const InputSectionBase<ELFT> *InputSec, |
| 208 | uintX_t OffsetInSec, bool UseSymVA, SymbolBody *Sym, |
| 209 | uintX_t Addend) |
| 210 | : Type(Type), Sym(Sym), InputSec(InputSec), OffsetInSec(OffsetInSec), |
| 211 | UseSymVA(UseSymVA), Addend(Addend) {} |
| 212 | |
| 213 | DynamicReloc(uint32_t Type, const OutputSectionBase<ELFT> *OutputSec, |
| 214 | uintX_t OffsetInSec, bool UseSymVA, SymbolBody *Sym, |
| 215 | uintX_t Addend) |
| 216 | : Type(Type), Sym(Sym), OutputSec(OutputSec), OffsetInSec(OffsetInSec), |
| 217 | UseSymVA(UseSymVA), Addend(Addend) {} |
| 218 | |
| 219 | uintX_t getOffset() const; |
| 220 | uintX_t getAddend() const; |
| 221 | uint32_t getSymIndex() const; |
Simon Atanasyan | 002e244 | 2016-06-23 15:26:31 +0000 | [diff] [blame^] | 222 | const OutputSectionBase<ELFT> *getOutputSec() const { return OutputSec; } |
Rui Ueyama | 809d8e2 | 2016-06-23 04:33:42 +0000 | [diff] [blame] | 223 | |
Rafael Espindola | de9857e | 2016-02-04 21:33:05 +0000 | [diff] [blame] | 224 | uint32_t Type; |
| 225 | |
Rui Ueyama | 809d8e2 | 2016-06-23 04:33:42 +0000 | [diff] [blame] | 226 | private: |
Rafael Espindola | ac568f9 | 2016-04-11 13:47:35 +0000 | [diff] [blame] | 227 | SymbolBody *Sym; |
Rui Ueyama | 809d8e2 | 2016-06-23 04:33:42 +0000 | [diff] [blame] | 228 | const InputSectionBase<ELFT> *InputSec = nullptr; |
| 229 | const OutputSectionBase<ELFT> *OutputSec = nullptr; |
Rafael Espindola | ac568f9 | 2016-04-11 13:47:35 +0000 | [diff] [blame] | 230 | uintX_t OffsetInSec; |
| 231 | bool UseSymVA; |
| 232 | uintX_t Addend; |
Rafael Espindola | 5805c4f | 2015-09-21 21:38:08 +0000 | [diff] [blame] | 233 | }; |
| 234 | |
| 235 | template <class ELFT> |
Rui Ueyama | c7cc6ec | 2015-10-15 22:27:29 +0000 | [diff] [blame] | 236 | class SymbolTableSection final : public OutputSectionBase<ELFT> { |
Rafael Espindola | 5805c4f | 2015-09-21 21:38:08 +0000 | [diff] [blame] | 237 | public: |
Rui Ueyama | 9328b2c | 2016-03-14 23:16:09 +0000 | [diff] [blame] | 238 | typedef typename ELFT::Shdr Elf_Shdr; |
| 239 | typedef typename ELFT::Sym Elf_Sym; |
| 240 | typedef typename ELFT::SymRange Elf_Sym_Range; |
| 241 | typedef typename ELFT::uint uintX_t; |
Rui Ueyama | ace4f90 | 2016-05-24 04:25:47 +0000 | [diff] [blame] | 242 | SymbolTableSection(StringTableSection<ELFT> &StrTabSec); |
Rafael Espindola | 5805c4f | 2015-09-21 21:38:08 +0000 | [diff] [blame] | 243 | |
Rui Ueyama | 0db335f | 2015-10-07 16:58:54 +0000 | [diff] [blame] | 244 | void finalize() override; |
Rafael Espindola | 5805c4f | 2015-09-21 21:38:08 +0000 | [diff] [blame] | 245 | void writeTo(uint8_t *Buf) override; |
Igor Kudrin | ab665fc | 2015-10-20 21:47:58 +0000 | [diff] [blame] | 246 | void addSymbol(SymbolBody *Body); |
Rui Ueyama | c7cc6ec | 2015-10-15 22:27:29 +0000 | [diff] [blame] | 247 | StringTableSection<ELFT> &getStrTabSec() const { return StrTabSec; } |
Rafael Espindola | 0e92f24 | 2016-01-27 16:41:24 +0000 | [diff] [blame] | 248 | unsigned getNumSymbols() const { return NumLocals + Symbols.size() + 1; } |
Rafael Espindola | 5805c4f | 2015-09-21 21:38:08 +0000 | [diff] [blame] | 249 | |
Rui Ueyama | c2e863a | 2016-02-17 05:06:40 +0000 | [diff] [blame] | 250 | ArrayRef<std::pair<SymbolBody *, size_t>> getSymbols() const { |
Rafael Espindola | e2c2461 | 2016-01-29 01:24:25 +0000 | [diff] [blame] | 251 | return Symbols; |
| 252 | } |
| 253 | |
| 254 | unsigned NumLocals = 0; |
| 255 | StringTableSection<ELFT> &StrTabSec; |
Igor Kudrin | ab665fc | 2015-10-20 21:47:58 +0000 | [diff] [blame] | 256 | |
Rafael Espindola | 5805c4f | 2015-09-21 21:38:08 +0000 | [diff] [blame] | 257 | private: |
Rui Ueyama | 8ddfa81 | 2015-09-30 00:32:10 +0000 | [diff] [blame] | 258 | void writeLocalSymbols(uint8_t *&Buf); |
Igor Kudrin | ea6a835 | 2015-10-19 08:01:51 +0000 | [diff] [blame] | 259 | void writeGlobalSymbols(uint8_t *Buf); |
Rui Ueyama | 8ddfa81 | 2015-09-30 00:32:10 +0000 | [diff] [blame] | 260 | |
Rui Ueyama | 874e7ae | 2016-02-17 04:56:44 +0000 | [diff] [blame] | 261 | const OutputSectionBase<ELFT> *getOutputSection(SymbolBody *Sym); |
Igor Kudrin | 853b88d | 2015-10-20 20:52:14 +0000 | [diff] [blame] | 262 | |
Rui Ueyama | c2e863a | 2016-02-17 05:06:40 +0000 | [diff] [blame] | 263 | // A vector of symbols and their string table offsets. |
| 264 | std::vector<std::pair<SymbolBody *, size_t>> Symbols; |
Rafael Espindola | 5805c4f | 2015-09-21 21:38:08 +0000 | [diff] [blame] | 265 | }; |
| 266 | |
Peter Collingbourne | 21a12fc | 2016-04-27 20:22:31 +0000 | [diff] [blame] | 267 | // For more information about .gnu.version and .gnu.version_r see: |
| 268 | // https://www.akkadia.org/drepper/symbol-versioning |
| 269 | |
George Rimar | d356630 | 2016-06-20 11:55:12 +0000 | [diff] [blame] | 270 | // The .gnu.version_d section which has a section type of SHT_GNU_verdef shall |
| 271 | // contain symbol version definitions. The number of entries in this section |
| 272 | // shall be contained in the DT_VERDEFNUM entry of the .dynamic section. |
| 273 | // The section shall contain an array of Elf_Verdef structures, optionally |
| 274 | // followed by an array of Elf_Verdaux structures. |
| 275 | template <class ELFT> |
| 276 | class VersionDefinitionSection final : public OutputSectionBase<ELFT> { |
| 277 | typedef typename ELFT::Verdef Elf_Verdef; |
| 278 | typedef typename ELFT::Verdaux Elf_Verdaux; |
| 279 | |
| 280 | unsigned FileDefNameOff; |
| 281 | |
| 282 | public: |
| 283 | VersionDefinitionSection(); |
| 284 | void finalize() override; |
| 285 | void writeTo(uint8_t *Buf) override; |
| 286 | }; |
| 287 | |
Peter Collingbourne | 21a12fc | 2016-04-27 20:22:31 +0000 | [diff] [blame] | 288 | // The .gnu.version section specifies the required version of each symbol in the |
| 289 | // dynamic symbol table. It contains one Elf_Versym for each dynamic symbol |
| 290 | // table entry. An Elf_Versym is just a 16-bit integer that refers to a version |
George Rimar | d356630 | 2016-06-20 11:55:12 +0000 | [diff] [blame] | 291 | // identifier defined in the either .gnu.version_r or .gnu.version_d section. |
| 292 | // The values 0 and 1 are reserved. All other values are used for versions in |
| 293 | // the own object or in any of the dependencies. |
Peter Collingbourne | 21a12fc | 2016-04-27 20:22:31 +0000 | [diff] [blame] | 294 | template <class ELFT> |
| 295 | class VersionTableSection final : public OutputSectionBase<ELFT> { |
| 296 | typedef typename ELFT::Versym Elf_Versym; |
| 297 | |
| 298 | public: |
| 299 | VersionTableSection(); |
| 300 | void finalize() override; |
| 301 | void writeTo(uint8_t *Buf) override; |
| 302 | }; |
| 303 | |
| 304 | // The .gnu.version_r section defines the version identifiers used by |
| 305 | // .gnu.version. It contains a linked list of Elf_Verneed data structures. Each |
| 306 | // Elf_Verneed specifies the version requirements for a single DSO, and contains |
| 307 | // a reference to a linked list of Elf_Vernaux data structures which define the |
| 308 | // mapping from version identifiers to version names. |
| 309 | template <class ELFT> |
| 310 | class VersionNeedSection final : public OutputSectionBase<ELFT> { |
| 311 | typedef typename ELFT::Verneed Elf_Verneed; |
| 312 | typedef typename ELFT::Vernaux Elf_Vernaux; |
| 313 | |
| 314 | // A vector of shared files that need Elf_Verneed data structures and the |
| 315 | // string table offsets of their sonames. |
| 316 | std::vector<std::pair<SharedFile<ELFT> *, size_t>> Needed; |
| 317 | |
George Rimar | d356630 | 2016-06-20 11:55:12 +0000 | [diff] [blame] | 318 | // The next available version identifier. |
| 319 | unsigned NextIndex; |
Peter Collingbourne | 21a12fc | 2016-04-27 20:22:31 +0000 | [diff] [blame] | 320 | |
| 321 | public: |
| 322 | VersionNeedSection(); |
| 323 | void addSymbol(SharedSymbol<ELFT> *SS); |
| 324 | void finalize() override; |
| 325 | void writeTo(uint8_t *Buf) override; |
| 326 | size_t getNeedNum() const { return Needed.size(); } |
| 327 | }; |
| 328 | |
Rafael Espindola | 5805c4f | 2015-09-21 21:38:08 +0000 | [diff] [blame] | 329 | template <class ELFT> |
Rui Ueyama | c7cc6ec | 2015-10-15 22:27:29 +0000 | [diff] [blame] | 330 | class RelocationSection final : public OutputSectionBase<ELFT> { |
Rui Ueyama | 9328b2c | 2016-03-14 23:16:09 +0000 | [diff] [blame] | 331 | typedef typename ELFT::Rel Elf_Rel; |
| 332 | typedef typename ELFT::Rela Elf_Rela; |
| 333 | typedef typename ELFT::uint uintX_t; |
Rafael Espindola | 5805c4f | 2015-09-21 21:38:08 +0000 | [diff] [blame] | 334 | |
| 335 | public: |
George Rimar | c191acf | 2016-05-10 15:47:57 +0000 | [diff] [blame] | 336 | RelocationSection(StringRef Name, bool Sort); |
Rafael Espindola | d30eb7d | 2016-02-05 15:03:10 +0000 | [diff] [blame] | 337 | void addReloc(const DynamicReloc<ELFT> &Reloc); |
George Rimar | 77b7779 | 2015-11-25 22:15:01 +0000 | [diff] [blame] | 338 | unsigned getRelocOffset(); |
Rafael Espindola | 5805c4f | 2015-09-21 21:38:08 +0000 | [diff] [blame] | 339 | void finalize() override; |
| 340 | void writeTo(uint8_t *Buf) override; |
| 341 | bool hasRelocs() const { return !Relocs.empty(); } |
Rafael Espindola | 5805c4f | 2015-09-21 21:38:08 +0000 | [diff] [blame] | 342 | |
George Rimar | a07ff66 | 2015-12-21 10:12:06 +0000 | [diff] [blame] | 343 | bool Static = false; |
| 344 | |
Rafael Espindola | 5805c4f | 2015-09-21 21:38:08 +0000 | [diff] [blame] | 345 | private: |
George Rimar | c191acf | 2016-05-10 15:47:57 +0000 | [diff] [blame] | 346 | bool Sort; |
Rafael Espindola | 5805c4f | 2015-09-21 21:38:08 +0000 | [diff] [blame] | 347 | std::vector<DynamicReloc<ELFT>> Relocs; |
Rafael Espindola | 5805c4f | 2015-09-21 21:38:08 +0000 | [diff] [blame] | 348 | }; |
| 349 | |
| 350 | template <class ELFT> |
Rui Ueyama | c7cc6ec | 2015-10-15 22:27:29 +0000 | [diff] [blame] | 351 | class OutputSection final : public OutputSectionBase<ELFT> { |
Rafael Espindola | 5805c4f | 2015-09-21 21:38:08 +0000 | [diff] [blame] | 352 | public: |
Rui Ueyama | 9328b2c | 2016-03-14 23:16:09 +0000 | [diff] [blame] | 353 | typedef typename ELFT::Shdr Elf_Shdr; |
| 354 | typedef typename ELFT::Sym Elf_Sym; |
| 355 | typedef typename ELFT::Rel Elf_Rel; |
| 356 | typedef typename ELFT::Rela Elf_Rela; |
| 357 | typedef typename ELFT::uint uintX_t; |
George Rimar | 9bec24a | 2016-02-18 14:20:08 +0000 | [diff] [blame] | 358 | OutputSection(StringRef Name, uint32_t Type, uintX_t Flags); |
Rui Ueyama | 40845e6 | 2015-12-26 05:51:07 +0000 | [diff] [blame] | 359 | void addSection(InputSectionBase<ELFT> *C) override; |
Rui Ueyama | 5af8368 | 2016-02-11 23:41:38 +0000 | [diff] [blame] | 360 | void sortInitFini(); |
| 361 | void sortCtorsDtors(); |
Rafael Espindola | 5805c4f | 2015-09-21 21:38:08 +0000 | [diff] [blame] | 362 | void writeTo(uint8_t *Buf) override; |
George Rimar | 58941ee | 2016-02-25 08:23:37 +0000 | [diff] [blame] | 363 | void finalize() override; |
Rui Ueyama | 809d8e2 | 2016-06-23 04:33:42 +0000 | [diff] [blame] | 364 | void assignOffsets() override; |
Rafael Espindola | 7167585 | 2015-09-22 00:16:19 +0000 | [diff] [blame] | 365 | std::vector<InputSection<ELFT> *> Sections; |
Rafael Espindola | 5805c4f | 2015-09-21 21:38:08 +0000 | [diff] [blame] | 366 | }; |
| 367 | |
Rui Ueyama | c7cc6ec | 2015-10-15 22:27:29 +0000 | [diff] [blame] | 368 | template <class ELFT> |
Rafael Espindola | c159c96 | 2015-10-19 21:00:02 +0000 | [diff] [blame] | 369 | class MergeOutputSection final : public OutputSectionBase<ELFT> { |
Rui Ueyama | 9328b2c | 2016-03-14 23:16:09 +0000 | [diff] [blame] | 370 | typedef typename ELFT::uint uintX_t; |
Rafael Espindola | c159c96 | 2015-10-19 21:00:02 +0000 | [diff] [blame] | 371 | |
| 372 | public: |
Rafael Espindola | 7efa5be | 2016-02-19 14:17:40 +0000 | [diff] [blame] | 373 | MergeOutputSection(StringRef Name, uint32_t Type, uintX_t Flags, |
| 374 | uintX_t Alignment); |
Rui Ueyama | 40845e6 | 2015-12-26 05:51:07 +0000 | [diff] [blame] | 375 | void addSection(InputSectionBase<ELFT> *S) override; |
Rafael Espindola | c159c96 | 2015-10-19 21:00:02 +0000 | [diff] [blame] | 376 | void writeTo(uint8_t *Buf) override; |
Rafael Espindola | f82ed2a | 2015-10-24 22:51:01 +0000 | [diff] [blame] | 377 | unsigned getOffset(StringRef Val); |
| 378 | void finalize() override; |
Rui Ueyama | 406b469 | 2016-05-27 14:39:13 +0000 | [diff] [blame] | 379 | void finalizePieces() override; |
Peter Collingbourne | e29e142 | 2016-05-05 04:10:12 +0000 | [diff] [blame] | 380 | bool shouldTailMerge() const; |
Rafael Espindola | c159c96 | 2015-10-19 21:00:02 +0000 | [diff] [blame] | 381 | |
| 382 | private: |
Rafael Espindola | 7efa5be | 2016-02-19 14:17:40 +0000 | [diff] [blame] | 383 | llvm::StringTableBuilder Builder; |
Rui Ueyama | 406b469 | 2016-05-27 14:39:13 +0000 | [diff] [blame] | 384 | std::vector<MergeInputSection<ELFT> *> Sections; |
Rafael Espindola | c159c96 | 2015-10-19 21:00:02 +0000 | [diff] [blame] | 385 | }; |
| 386 | |
Rui Ueyama | f8b285c | 2016-05-22 23:16:14 +0000 | [diff] [blame] | 387 | struct CieRecord { |
| 388 | SectionPiece *Piece = nullptr; |
| 389 | std::vector<SectionPiece *> FdePieces; |
Rafael Espindola | 0c6a4f1 | 2015-11-11 19:54:14 +0000 | [diff] [blame] | 390 | }; |
| 391 | |
Rui Ueyama | f8b285c | 2016-05-22 23:16:14 +0000 | [diff] [blame] | 392 | // Output section for .eh_frame. |
Rafael Espindola | 0c6a4f1 | 2015-11-11 19:54:14 +0000 | [diff] [blame] | 393 | template <class ELFT> |
Rui Ueyama | 1e479c2 | 2016-05-23 15:07:59 +0000 | [diff] [blame] | 394 | class EhOutputSection final : public OutputSectionBase<ELFT> { |
Rui Ueyama | 9328b2c | 2016-03-14 23:16:09 +0000 | [diff] [blame] | 395 | typedef typename ELFT::uint uintX_t; |
| 396 | typedef typename ELFT::Shdr Elf_Shdr; |
| 397 | typedef typename ELFT::Rel Elf_Rel; |
| 398 | typedef typename ELFT::Rela Elf_Rela; |
Rui Ueyama | f86cb90 | 2016-05-23 15:12:41 +0000 | [diff] [blame] | 399 | |
| 400 | public: |
| 401 | EhOutputSection(); |
Rafael Espindola | 0c6a4f1 | 2015-11-11 19:54:14 +0000 | [diff] [blame] | 402 | void writeTo(uint8_t *Buf) override; |
Rafael Espindola | 56004c5 | 2016-04-07 14:22:09 +0000 | [diff] [blame] | 403 | void finalize() override; |
Rui Ueyama | 3b31e67 | 2016-05-23 16:24:16 +0000 | [diff] [blame] | 404 | bool empty() const { return Sections.empty(); } |
Rafael Espindola | 0c6a4f1 | 2015-11-11 19:54:14 +0000 | [diff] [blame] | 405 | |
Rui Ueyama | 40845e6 | 2015-12-26 05:51:07 +0000 | [diff] [blame] | 406 | void addSection(InputSectionBase<ELFT> *S) override; |
Rafael Espindola | 0c6a4f1 | 2015-11-11 19:54:14 +0000 | [diff] [blame] | 407 | |
Rui Ueyama | de9777a | 2016-05-23 16:30:41 +0000 | [diff] [blame] | 408 | size_t NumFdes = 0; |
| 409 | |
Rafael Espindola | 0c6a4f1 | 2015-11-11 19:54:14 +0000 | [diff] [blame] | 410 | private: |
Rui Ueyama | f8b285c | 2016-05-22 23:16:14 +0000 | [diff] [blame] | 411 | template <class RelTy> |
Rui Ueyama | 0b9a903 | 2016-05-24 04:19:20 +0000 | [diff] [blame] | 412 | void addSectionAux(EhInputSection<ELFT> *S, llvm::ArrayRef<RelTy> Rels); |
Rui Ueyama | f8b285c | 2016-05-22 23:16:14 +0000 | [diff] [blame] | 413 | |
Rui Ueyama | f8b285c | 2016-05-22 23:16:14 +0000 | [diff] [blame] | 414 | template <class RelTy> |
Rui Ueyama | 0b9a903 | 2016-05-24 04:19:20 +0000 | [diff] [blame] | 415 | CieRecord *addCie(SectionPiece &Piece, EhInputSection<ELFT> *Sec, |
Rui Ueyama | 19ccffe | 2016-05-24 15:40:46 +0000 | [diff] [blame] | 416 | ArrayRef<RelTy> &Rels); |
Rui Ueyama | f8b285c | 2016-05-22 23:16:14 +0000 | [diff] [blame] | 417 | |
| 418 | template <class RelTy> |
Rui Ueyama | 0b9a903 | 2016-05-24 04:19:20 +0000 | [diff] [blame] | 419 | bool isFdeLive(SectionPiece &Piece, EhInputSection<ELFT> *Sec, |
Rui Ueyama | 19ccffe | 2016-05-24 15:40:46 +0000 | [diff] [blame] | 420 | ArrayRef<RelTy> &Rels); |
Rui Ueyama | f8b285c | 2016-05-22 23:16:14 +0000 | [diff] [blame] | 421 | |
Rui Ueyama | e75e933 | 2016-05-23 03:00:33 +0000 | [diff] [blame] | 422 | uintX_t getFdePc(uint8_t *Buf, size_t Off, uint8_t Enc); |
| 423 | |
Rui Ueyama | 0b9a903 | 2016-05-24 04:19:20 +0000 | [diff] [blame] | 424 | std::vector<EhInputSection<ELFT> *> Sections; |
Rui Ueyama | f8b285c | 2016-05-22 23:16:14 +0000 | [diff] [blame] | 425 | std::vector<CieRecord *> Cies; |
Rafael Espindola | 0c6a4f1 | 2015-11-11 19:54:14 +0000 | [diff] [blame] | 426 | |
Rui Ueyama | f8b285c | 2016-05-22 23:16:14 +0000 | [diff] [blame] | 427 | // CIE records are uniquified by their contents and personality functions. |
| 428 | llvm::DenseMap<std::pair<ArrayRef<uint8_t>, SymbolBody *>, CieRecord> CieMap; |
| 429 | |
Rafael Espindola | 56004c5 | 2016-04-07 14:22:09 +0000 | [diff] [blame] | 430 | bool Finalized = false; |
Rafael Espindola | 0c6a4f1 | 2015-11-11 19:54:14 +0000 | [diff] [blame] | 431 | }; |
| 432 | |
Rafael Espindola | c159c96 | 2015-10-19 21:00:02 +0000 | [diff] [blame] | 433 | template <class ELFT> |
Rui Ueyama | c7cc6ec | 2015-10-15 22:27:29 +0000 | [diff] [blame] | 434 | class InterpSection final : public OutputSectionBase<ELFT> { |
Rafael Espindola | 5805c4f | 2015-09-21 21:38:08 +0000 | [diff] [blame] | 435 | public: |
| 436 | InterpSection(); |
Eugene Zelenko | 6e43b49 | 2015-11-04 02:11:57 +0000 | [diff] [blame] | 437 | void writeTo(uint8_t *Buf) override; |
Rafael Espindola | 5805c4f | 2015-09-21 21:38:08 +0000 | [diff] [blame] | 438 | }; |
| 439 | |
Rui Ueyama | c7cc6ec | 2015-10-15 22:27:29 +0000 | [diff] [blame] | 440 | template <class ELFT> |
| 441 | class StringTableSection final : public OutputSectionBase<ELFT> { |
Rafael Espindola | 5805c4f | 2015-09-21 21:38:08 +0000 | [diff] [blame] | 442 | public: |
Rui Ueyama | 9328b2c | 2016-03-14 23:16:09 +0000 | [diff] [blame] | 443 | typedef typename ELFT::uint uintX_t; |
George Rimar | 0f5ac9f | 2015-10-20 17:21:35 +0000 | [diff] [blame] | 444 | StringTableSection(StringRef Name, bool Dynamic); |
Rafael Espindola | e2c2461 | 2016-01-29 01:24:25 +0000 | [diff] [blame] | 445 | unsigned addString(StringRef S, bool HashIt = true); |
Rafael Espindola | 5805c4f | 2015-09-21 21:38:08 +0000 | [diff] [blame] | 446 | void writeTo(uint8_t *Buf) override; |
Rafael Espindola | e2c2461 | 2016-01-29 01:24:25 +0000 | [diff] [blame] | 447 | unsigned getSize() const { return Size; } |
Rui Ueyama | 76c0063 | 2016-01-07 02:35:32 +0000 | [diff] [blame] | 448 | void finalize() override { this->Header.sh_size = getSize(); } |
Rafael Espindola | 5805c4f | 2015-09-21 21:38:08 +0000 | [diff] [blame] | 449 | bool isDynamic() const { return Dynamic; } |
| 450 | |
| 451 | private: |
| 452 | const bool Dynamic; |
Rafael Espindola | e2c2461 | 2016-01-29 01:24:25 +0000 | [diff] [blame] | 453 | llvm::DenseMap<StringRef, unsigned> StringMap; |
Rui Ueyama | 76c0063 | 2016-01-07 02:35:32 +0000 | [diff] [blame] | 454 | std::vector<StringRef> Strings; |
Rafael Espindola | e2c2461 | 2016-01-29 01:24:25 +0000 | [diff] [blame] | 455 | unsigned Size = 1; // ELF string tables start with a NUL byte, so 1. |
Rafael Espindola | 5805c4f | 2015-09-21 21:38:08 +0000 | [diff] [blame] | 456 | }; |
| 457 | |
| 458 | template <class ELFT> |
Rui Ueyama | c7cc6ec | 2015-10-15 22:27:29 +0000 | [diff] [blame] | 459 | class HashTableSection final : public OutputSectionBase<ELFT> { |
Rui Ueyama | 9328b2c | 2016-03-14 23:16:09 +0000 | [diff] [blame] | 460 | typedef typename ELFT::Word Elf_Word; |
Rafael Espindola | 5805c4f | 2015-09-21 21:38:08 +0000 | [diff] [blame] | 461 | |
| 462 | public: |
Rui Ueyama | 15ef5e1 | 2015-10-07 19:18:16 +0000 | [diff] [blame] | 463 | HashTableSection(); |
Rui Ueyama | 0db335f | 2015-10-07 16:58:54 +0000 | [diff] [blame] | 464 | void finalize() override; |
| 465 | void writeTo(uint8_t *Buf) override; |
Rafael Espindola | 5805c4f | 2015-09-21 21:38:08 +0000 | [diff] [blame] | 466 | }; |
| 467 | |
Igor Kudrin | 1b0d706 | 2015-10-22 08:21:35 +0000 | [diff] [blame] | 468 | // Outputs GNU Hash section. For detailed explanation see: |
| 469 | // https://blogs.oracle.com/ali/entry/gnu_hash_elf_sections |
| 470 | template <class ELFT> |
| 471 | class GnuHashTableSection final : public OutputSectionBase<ELFT> { |
Rui Ueyama | 9328b2c | 2016-03-14 23:16:09 +0000 | [diff] [blame] | 472 | typedef typename ELFT::Off Elf_Off; |
| 473 | typedef typename ELFT::Word Elf_Word; |
| 474 | typedef typename ELFT::uint uintX_t; |
Igor Kudrin | 1b0d706 | 2015-10-22 08:21:35 +0000 | [diff] [blame] | 475 | |
| 476 | public: |
| 477 | GnuHashTableSection(); |
| 478 | void finalize() override; |
| 479 | void writeTo(uint8_t *Buf) override; |
| 480 | |
Igor Kudrin | f1d6029 | 2015-10-28 07:05:56 +0000 | [diff] [blame] | 481 | // Adds symbols to the hash table. |
| 482 | // Sorts the input to satisfy GNU hash section requirements. |
Rui Ueyama | c2e863a | 2016-02-17 05:06:40 +0000 | [diff] [blame] | 483 | void addSymbols(std::vector<std::pair<SymbolBody *, size_t>> &Symbols); |
Igor Kudrin | 1b0d706 | 2015-10-22 08:21:35 +0000 | [diff] [blame] | 484 | |
| 485 | private: |
Igor Kudrin | f1d6029 | 2015-10-28 07:05:56 +0000 | [diff] [blame] | 486 | static unsigned calcNBuckets(unsigned NumHashed); |
Igor Kudrin | 1b0d706 | 2015-10-22 08:21:35 +0000 | [diff] [blame] | 487 | static unsigned calcMaskWords(unsigned NumHashed); |
| 488 | |
| 489 | void writeHeader(uint8_t *&Buf); |
| 490 | void writeBloomFilter(uint8_t *&Buf); |
| 491 | void writeHashTable(uint8_t *Buf); |
| 492 | |
Rui Ueyama | 861c731 | 2016-02-17 05:40:03 +0000 | [diff] [blame] | 493 | struct SymbolData { |
Igor Kudrin | f1d6029 | 2015-10-28 07:05:56 +0000 | [diff] [blame] | 494 | SymbolBody *Body; |
Rui Ueyama | c2e863a | 2016-02-17 05:06:40 +0000 | [diff] [blame] | 495 | size_t STName; |
Igor Kudrin | f1d6029 | 2015-10-28 07:05:56 +0000 | [diff] [blame] | 496 | uint32_t Hash; |
| 497 | }; |
| 498 | |
Rui Ueyama | 861c731 | 2016-02-17 05:40:03 +0000 | [diff] [blame] | 499 | std::vector<SymbolData> Symbols; |
Igor Kudrin | f1d6029 | 2015-10-28 07:05:56 +0000 | [diff] [blame] | 500 | |
Igor Kudrin | 1b0d706 | 2015-10-22 08:21:35 +0000 | [diff] [blame] | 501 | unsigned MaskWords; |
| 502 | unsigned NBuckets; |
| 503 | unsigned Shift2; |
| 504 | }; |
| 505 | |
Rafael Espindola | 5805c4f | 2015-09-21 21:38:08 +0000 | [diff] [blame] | 506 | template <class ELFT> |
Rui Ueyama | c7cc6ec | 2015-10-15 22:27:29 +0000 | [diff] [blame] | 507 | class DynamicSection final : public OutputSectionBase<ELFT> { |
| 508 | typedef OutputSectionBase<ELFT> Base; |
Rui Ueyama | 9328b2c | 2016-03-14 23:16:09 +0000 | [diff] [blame] | 509 | typedef typename ELFT::Dyn Elf_Dyn; |
| 510 | typedef typename ELFT::Rel Elf_Rel; |
| 511 | typedef typename ELFT::Rela Elf_Rela; |
| 512 | typedef typename ELFT::Shdr Elf_Shdr; |
| 513 | typedef typename ELFT::Sym Elf_Sym; |
| 514 | typedef typename ELFT::uint uintX_t; |
Rafael Espindola | de06936 | 2016-01-25 21:32:04 +0000 | [diff] [blame] | 515 | |
Rui Ueyama | 909cc68 | 2016-02-02 03:11:27 +0000 | [diff] [blame] | 516 | // The .dynamic section contains information for the dynamic linker. |
| 517 | // The section consists of fixed size entries, which consist of |
| 518 | // type and value fields. Value are one of plain integers, symbol |
| 519 | // addresses, or section addresses. This struct represents the entry. |
Rafael Espindola | de06936 | 2016-01-25 21:32:04 +0000 | [diff] [blame] | 520 | struct Entry { |
| 521 | int32_t Tag; |
| 522 | union { |
| 523 | OutputSectionBase<ELFT> *OutSec; |
| 524 | uint64_t Val; |
| 525 | const SymbolBody *Sym; |
| 526 | }; |
| 527 | enum KindT { SecAddr, SymAddr, PlainInt } Kind; |
| 528 | Entry(int32_t Tag, OutputSectionBase<ELFT> *OutSec) |
| 529 | : Tag(Tag), OutSec(OutSec), Kind(SecAddr) {} |
| 530 | Entry(int32_t Tag, uint64_t Val) : Tag(Tag), Val(Val), Kind(PlainInt) {} |
| 531 | Entry(int32_t Tag, const SymbolBody *Sym) |
| 532 | : Tag(Tag), Sym(Sym), Kind(SymAddr) {} |
| 533 | }; |
Rui Ueyama | 909cc68 | 2016-02-02 03:11:27 +0000 | [diff] [blame] | 534 | |
| 535 | // finalize() fills this vector with the section contents. finalize() |
| 536 | // cannot directly create final section contents because when the |
| 537 | // function is called, symbol or section addresses are not fixed yet. |
Rafael Espindola | de06936 | 2016-01-25 21:32:04 +0000 | [diff] [blame] | 538 | std::vector<Entry> Entries; |
Rafael Espindola | 5805c4f | 2015-09-21 21:38:08 +0000 | [diff] [blame] | 539 | |
| 540 | public: |
Rui Ueyama | ace4f90 | 2016-05-24 04:25:47 +0000 | [diff] [blame] | 541 | explicit DynamicSection(); |
Rafael Espindola | 5805c4f | 2015-09-21 21:38:08 +0000 | [diff] [blame] | 542 | void finalize() override; |
| 543 | void writeTo(uint8_t *Buf) override; |
| 544 | |
Rui Ueyama | c7cc6ec | 2015-10-15 22:27:29 +0000 | [diff] [blame] | 545 | OutputSectionBase<ELFT> *PreInitArraySec = nullptr; |
| 546 | OutputSectionBase<ELFT> *InitArraySec = nullptr; |
| 547 | OutputSectionBase<ELFT> *FiniArraySec = nullptr; |
Rafael Espindola | 5805c4f | 2015-09-21 21:38:08 +0000 | [diff] [blame] | 548 | }; |
Rui Ueyama | 15ef5e1 | 2015-10-07 19:18:16 +0000 | [diff] [blame] | 549 | |
Simon Atanasyan | 1d7df40 | 2015-12-20 10:57:34 +0000 | [diff] [blame] | 550 | template <class ELFT> |
| 551 | class MipsReginfoOutputSection final : public OutputSectionBase<ELFT> { |
| 552 | typedef llvm::object::Elf_Mips_RegInfo<ELFT> Elf_Mips_RegInfo; |
| 553 | |
| 554 | public: |
| 555 | MipsReginfoOutputSection(); |
| 556 | void writeTo(uint8_t *Buf) override; |
Rui Ueyama | 40845e6 | 2015-12-26 05:51:07 +0000 | [diff] [blame] | 557 | void addSection(InputSectionBase<ELFT> *S) override; |
Simon Atanasyan | 1d7df40 | 2015-12-20 10:57:34 +0000 | [diff] [blame] | 558 | |
| 559 | private: |
Rui Ueyama | 70eed36 | 2016-01-06 22:42:43 +0000 | [diff] [blame] | 560 | uint32_t GprMask = 0; |
Simon Atanasyan | 1d7df40 | 2015-12-20 10:57:34 +0000 | [diff] [blame] | 561 | }; |
| 562 | |
Simon Atanasyan | add74f3 | 2016-05-04 10:07:38 +0000 | [diff] [blame] | 563 | template <class ELFT> |
| 564 | class MipsOptionsOutputSection final : public OutputSectionBase<ELFT> { |
| 565 | typedef llvm::object::Elf_Mips_Options<ELFT> Elf_Mips_Options; |
| 566 | typedef llvm::object::Elf_Mips_RegInfo<ELFT> Elf_Mips_RegInfo; |
| 567 | |
| 568 | public: |
| 569 | MipsOptionsOutputSection(); |
| 570 | void writeTo(uint8_t *Buf) override; |
| 571 | void addSection(InputSectionBase<ELFT> *S) override; |
| 572 | |
| 573 | private: |
| 574 | uint32_t GprMask = 0; |
| 575 | }; |
| 576 | |
George Rimar | f6bc65a | 2016-01-15 13:34:52 +0000 | [diff] [blame] | 577 | // --eh-frame-hdr option tells linker to construct a header for all the |
| 578 | // .eh_frame sections. This header is placed to a section named .eh_frame_hdr |
| 579 | // and also to a PT_GNU_EH_FRAME segment. |
| 580 | // At runtime the unwinder then can find all the PT_GNU_EH_FRAME segments by |
| 581 | // calling dl_iterate_phdr. |
| 582 | // This section contains a lookup table for quick binary search of FDEs. |
| 583 | // Detailed info about internals can be found in Ian Lance Taylor's blog: |
| 584 | // http://www.airs.com/blog/archives/460 (".eh_frame") |
| 585 | // http://www.airs.com/blog/archives/462 (".eh_frame_hdr") |
| 586 | template <class ELFT> |
| 587 | class EhFrameHeader final : public OutputSectionBase<ELFT> { |
Rui Ueyama | 9328b2c | 2016-03-14 23:16:09 +0000 | [diff] [blame] | 588 | typedef typename ELFT::uint uintX_t; |
George Rimar | f6bc65a | 2016-01-15 13:34:52 +0000 | [diff] [blame] | 589 | |
| 590 | public: |
| 591 | EhFrameHeader(); |
Rui Ueyama | de9777a | 2016-05-23 16:30:41 +0000 | [diff] [blame] | 592 | void finalize() override; |
George Rimar | f6bc65a | 2016-01-15 13:34:52 +0000 | [diff] [blame] | 593 | void writeTo(uint8_t *Buf) override; |
Rui Ueyama | e75e933 | 2016-05-23 03:00:33 +0000 | [diff] [blame] | 594 | void addFde(uint32_t Pc, uint32_t FdeVA); |
George Rimar | f6bc65a | 2016-01-15 13:34:52 +0000 | [diff] [blame] | 595 | |
George Rimar | f6bc65a | 2016-01-15 13:34:52 +0000 | [diff] [blame] | 596 | private: |
| 597 | struct FdeData { |
Rui Ueyama | e75e933 | 2016-05-23 03:00:33 +0000 | [diff] [blame] | 598 | uint32_t Pc; |
| 599 | uint32_t FdeVA; |
George Rimar | f6bc65a | 2016-01-15 13:34:52 +0000 | [diff] [blame] | 600 | }; |
| 601 | |
Rui Ueyama | e75e933 | 2016-05-23 03:00:33 +0000 | [diff] [blame] | 602 | std::vector<FdeData> Fdes; |
George Rimar | f6bc65a | 2016-01-15 13:34:52 +0000 | [diff] [blame] | 603 | }; |
| 604 | |
Rui Ueyama | 3a41be2 | 2016-04-07 22:49:21 +0000 | [diff] [blame] | 605 | template <class ELFT> class BuildIdSection : public OutputSectionBase<ELFT> { |
Rui Ueyama | 634ddf0 | 2016-03-11 20:51:53 +0000 | [diff] [blame] | 606 | public: |
Rui Ueyama | 634ddf0 | 2016-03-11 20:51:53 +0000 | [diff] [blame] | 607 | void writeTo(uint8_t *Buf) override; |
Rui Ueyama | dd368fc | 2016-05-02 23:35:59 +0000 | [diff] [blame] | 608 | virtual void writeBuildId(ArrayRef<ArrayRef<uint8_t>> Bufs) = 0; |
Rui Ueyama | 3a41be2 | 2016-04-07 22:49:21 +0000 | [diff] [blame] | 609 | |
| 610 | protected: |
| 611 | BuildIdSection(size_t HashSize); |
| 612 | size_t HashSize; |
| 613 | uint8_t *HashBuf = nullptr; |
| 614 | }; |
| 615 | |
| 616 | template <class ELFT> class BuildIdFnv1 final : public BuildIdSection<ELFT> { |
| 617 | public: |
| 618 | BuildIdFnv1() : BuildIdSection<ELFT>(8) {} |
Rui Ueyama | dd368fc | 2016-05-02 23:35:59 +0000 | [diff] [blame] | 619 | void writeBuildId(ArrayRef<ArrayRef<uint8_t>> Bufs) override; |
Rui Ueyama | 3a41be2 | 2016-04-07 22:49:21 +0000 | [diff] [blame] | 620 | }; |
| 621 | |
| 622 | template <class ELFT> class BuildIdMd5 final : public BuildIdSection<ELFT> { |
| 623 | public: |
| 624 | BuildIdMd5() : BuildIdSection<ELFT>(16) {} |
Rui Ueyama | dd368fc | 2016-05-02 23:35:59 +0000 | [diff] [blame] | 625 | void writeBuildId(ArrayRef<ArrayRef<uint8_t>> Bufs) override; |
Rui Ueyama | 634ddf0 | 2016-03-11 20:51:53 +0000 | [diff] [blame] | 626 | }; |
| 627 | |
Rui Ueyama | d86ec30 | 2016-04-07 23:51:56 +0000 | [diff] [blame] | 628 | template <class ELFT> class BuildIdSha1 final : public BuildIdSection<ELFT> { |
| 629 | public: |
| 630 | BuildIdSha1() : BuildIdSection<ELFT>(20) {} |
Rui Ueyama | dd368fc | 2016-05-02 23:35:59 +0000 | [diff] [blame] | 631 | void writeBuildId(ArrayRef<ArrayRef<uint8_t>> Bufs) override; |
Rui Ueyama | d86ec30 | 2016-04-07 23:51:56 +0000 | [diff] [blame] | 632 | }; |
| 633 | |
Rui Ueyama | 9194db7 | 2016-05-13 21:55:56 +0000 | [diff] [blame] | 634 | template <class ELFT> |
| 635 | class BuildIdHexstring final : public BuildIdSection<ELFT> { |
| 636 | public: |
| 637 | BuildIdHexstring(); |
| 638 | void writeBuildId(ArrayRef<ArrayRef<uint8_t>> Bufs) override; |
| 639 | }; |
| 640 | |
Rui Ueyama | 15ef5e1 | 2015-10-07 19:18:16 +0000 | [diff] [blame] | 641 | // All output sections that are hadnled by the linker specially are |
| 642 | // globally accessible. Writer initializes them, so don't use them |
| 643 | // until Writer is initialized. |
| 644 | template <class ELFT> struct Out { |
Rui Ueyama | 9328b2c | 2016-03-14 23:16:09 +0000 | [diff] [blame] | 645 | typedef typename ELFT::uint uintX_t; |
| 646 | typedef typename ELFT::Phdr Elf_Phdr; |
Rui Ueyama | 634ddf0 | 2016-03-11 20:51:53 +0000 | [diff] [blame] | 647 | static BuildIdSection<ELFT> *BuildId; |
Rui Ueyama | 15ef5e1 | 2015-10-07 19:18:16 +0000 | [diff] [blame] | 648 | static DynamicSection<ELFT> *Dynamic; |
George Rimar | f6bc65a | 2016-01-15 13:34:52 +0000 | [diff] [blame] | 649 | static EhFrameHeader<ELFT> *EhFrameHdr; |
Rui Ueyama | 3b31e67 | 2016-05-23 16:24:16 +0000 | [diff] [blame] | 650 | static EhOutputSection<ELFT> *EhFrame; |
Igor Kudrin | 1b0d706 | 2015-10-22 08:21:35 +0000 | [diff] [blame] | 651 | static GnuHashTableSection<ELFT> *GnuHashTab; |
George Rimar | 648a2c3 | 2015-10-20 08:54:27 +0000 | [diff] [blame] | 652 | static GotPltSection<ELFT> *GotPlt; |
Rui Ueyama | 15ef5e1 | 2015-10-07 19:18:16 +0000 | [diff] [blame] | 653 | static GotSection<ELFT> *Got; |
| 654 | static HashTableSection<ELFT> *HashTab; |
Rui Ueyama | c7cc6ec | 2015-10-15 22:27:29 +0000 | [diff] [blame] | 655 | static InterpSection<ELFT> *Interp; |
Rui Ueyama | 15ef5e1 | 2015-10-07 19:18:16 +0000 | [diff] [blame] | 656 | static OutputSection<ELFT> *Bss; |
Igor Kudrin | 304860a | 2015-11-12 04:39:49 +0000 | [diff] [blame] | 657 | static OutputSection<ELFT> *MipsRldMap; |
Rui Ueyama | c7cc6ec | 2015-10-15 22:27:29 +0000 | [diff] [blame] | 658 | static OutputSectionBase<ELFT> *Opd; |
Hal Finkel | daedc12 | 2015-10-12 23:16:53 +0000 | [diff] [blame] | 659 | static uint8_t *OpdBuf; |
Rui Ueyama | 15ef5e1 | 2015-10-07 19:18:16 +0000 | [diff] [blame] | 660 | static PltSection<ELFT> *Plt; |
| 661 | static RelocationSection<ELFT> *RelaDyn; |
George Rimar | 648a2c3 | 2015-10-20 08:54:27 +0000 | [diff] [blame] | 662 | static RelocationSection<ELFT> *RelaPlt; |
Rui Ueyama | c7cc6ec | 2015-10-15 22:27:29 +0000 | [diff] [blame] | 663 | static StringTableSection<ELFT> *DynStrTab; |
George Rimar | 0f5ac9f | 2015-10-20 17:21:35 +0000 | [diff] [blame] | 664 | static StringTableSection<ELFT> *ShStrTab; |
Rui Ueyama | c7cc6ec | 2015-10-15 22:27:29 +0000 | [diff] [blame] | 665 | static StringTableSection<ELFT> *StrTab; |
Rui Ueyama | 15ef5e1 | 2015-10-07 19:18:16 +0000 | [diff] [blame] | 666 | static SymbolTableSection<ELFT> *DynSymTab; |
| 667 | static SymbolTableSection<ELFT> *SymTab; |
George Rimar | d356630 | 2016-06-20 11:55:12 +0000 | [diff] [blame] | 668 | static VersionDefinitionSection<ELFT> *VerDef; |
Peter Collingbourne | 21a12fc | 2016-04-27 20:22:31 +0000 | [diff] [blame] | 669 | static VersionTableSection<ELFT> *VerSym; |
| 670 | static VersionNeedSection<ELFT> *VerNeed; |
Rafael Espindola | ea7a1e90 | 2015-11-06 22:14:44 +0000 | [diff] [blame] | 671 | static Elf_Phdr *TlsPhdr; |
Rafael Espindola | 4fc6044 | 2016-02-10 22:43:13 +0000 | [diff] [blame] | 672 | static OutputSectionBase<ELFT> *ElfHeader; |
| 673 | static OutputSectionBase<ELFT> *ProgramHeaders; |
Rui Ueyama | 15ef5e1 | 2015-10-07 19:18:16 +0000 | [diff] [blame] | 674 | }; |
Rui Ueyama | d888d10 | 2015-10-09 19:34:55 +0000 | [diff] [blame] | 675 | |
Rui Ueyama | 634ddf0 | 2016-03-11 20:51:53 +0000 | [diff] [blame] | 676 | template <class ELFT> BuildIdSection<ELFT> *Out<ELFT>::BuildId; |
Rui Ueyama | d888d10 | 2015-10-09 19:34:55 +0000 | [diff] [blame] | 677 | template <class ELFT> DynamicSection<ELFT> *Out<ELFT>::Dynamic; |
George Rimar | f6bc65a | 2016-01-15 13:34:52 +0000 | [diff] [blame] | 678 | template <class ELFT> EhFrameHeader<ELFT> *Out<ELFT>::EhFrameHdr; |
Rui Ueyama | 3b31e67 | 2016-05-23 16:24:16 +0000 | [diff] [blame] | 679 | template <class ELFT> EhOutputSection<ELFT> *Out<ELFT>::EhFrame; |
Igor Kudrin | 1b0d706 | 2015-10-22 08:21:35 +0000 | [diff] [blame] | 680 | template <class ELFT> GnuHashTableSection<ELFT> *Out<ELFT>::GnuHashTab; |
George Rimar | 648a2c3 | 2015-10-20 08:54:27 +0000 | [diff] [blame] | 681 | template <class ELFT> GotPltSection<ELFT> *Out<ELFT>::GotPlt; |
Rui Ueyama | d888d10 | 2015-10-09 19:34:55 +0000 | [diff] [blame] | 682 | template <class ELFT> GotSection<ELFT> *Out<ELFT>::Got; |
| 683 | template <class ELFT> HashTableSection<ELFT> *Out<ELFT>::HashTab; |
Rui Ueyama | c7cc6ec | 2015-10-15 22:27:29 +0000 | [diff] [blame] | 684 | template <class ELFT> InterpSection<ELFT> *Out<ELFT>::Interp; |
Rafael Espindola | d7a267b | 2015-11-03 22:01:20 +0000 | [diff] [blame] | 685 | template <class ELFT> OutputSection<ELFT> *Out<ELFT>::Bss; |
Igor Kudrin | 304860a | 2015-11-12 04:39:49 +0000 | [diff] [blame] | 686 | template <class ELFT> OutputSection<ELFT> *Out<ELFT>::MipsRldMap; |
Rui Ueyama | c7cc6ec | 2015-10-15 22:27:29 +0000 | [diff] [blame] | 687 | template <class ELFT> OutputSectionBase<ELFT> *Out<ELFT>::Opd; |
Hal Finkel | daedc12 | 2015-10-12 23:16:53 +0000 | [diff] [blame] | 688 | template <class ELFT> uint8_t *Out<ELFT>::OpdBuf; |
Rui Ueyama | d888d10 | 2015-10-09 19:34:55 +0000 | [diff] [blame] | 689 | template <class ELFT> PltSection<ELFT> *Out<ELFT>::Plt; |
| 690 | template <class ELFT> RelocationSection<ELFT> *Out<ELFT>::RelaDyn; |
George Rimar | 648a2c3 | 2015-10-20 08:54:27 +0000 | [diff] [blame] | 691 | template <class ELFT> RelocationSection<ELFT> *Out<ELFT>::RelaPlt; |
Rui Ueyama | c7cc6ec | 2015-10-15 22:27:29 +0000 | [diff] [blame] | 692 | template <class ELFT> StringTableSection<ELFT> *Out<ELFT>::DynStrTab; |
George Rimar | 0f5ac9f | 2015-10-20 17:21:35 +0000 | [diff] [blame] | 693 | template <class ELFT> StringTableSection<ELFT> *Out<ELFT>::ShStrTab; |
Rui Ueyama | c7cc6ec | 2015-10-15 22:27:29 +0000 | [diff] [blame] | 694 | template <class ELFT> StringTableSection<ELFT> *Out<ELFT>::StrTab; |
Rui Ueyama | d888d10 | 2015-10-09 19:34:55 +0000 | [diff] [blame] | 695 | template <class ELFT> SymbolTableSection<ELFT> *Out<ELFT>::DynSymTab; |
| 696 | template <class ELFT> SymbolTableSection<ELFT> *Out<ELFT>::SymTab; |
George Rimar | d356630 | 2016-06-20 11:55:12 +0000 | [diff] [blame] | 697 | template <class ELFT> VersionDefinitionSection<ELFT> *Out<ELFT>::VerDef; |
Peter Collingbourne | 21a12fc | 2016-04-27 20:22:31 +0000 | [diff] [blame] | 698 | template <class ELFT> VersionTableSection<ELFT> *Out<ELFT>::VerSym; |
| 699 | template <class ELFT> VersionNeedSection<ELFT> *Out<ELFT>::VerNeed; |
Rui Ueyama | 9328b2c | 2016-03-14 23:16:09 +0000 | [diff] [blame] | 700 | template <class ELFT> typename ELFT::Phdr *Out<ELFT>::TlsPhdr; |
Rafael Espindola | 4fc6044 | 2016-02-10 22:43:13 +0000 | [diff] [blame] | 701 | template <class ELFT> OutputSectionBase<ELFT> *Out<ELFT>::ElfHeader; |
| 702 | template <class ELFT> OutputSectionBase<ELFT> *Out<ELFT>::ProgramHeaders; |
Eugene Zelenko | 6e43b49 | 2015-11-04 02:11:57 +0000 | [diff] [blame] | 703 | |
Rafael Espindola | e0df00b | 2016-02-28 00:25:54 +0000 | [diff] [blame] | 704 | } // namespace elf |
Eugene Zelenko | 6e43b49 | 2015-11-04 02:11:57 +0000 | [diff] [blame] | 705 | } // namespace lld |
| 706 | |
| 707 | #endif // LLD_ELF_OUTPUT_SECTIONS_H |