Chris Lattner | 3201815 | 2005-06-27 06:28:45 +0000 | [diff] [blame] | 1 | //===-- ELFWriter.h - Target-independent ELF writer support -----*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Chris Lattner | 4ee451d | 2007-12-29 20:36:04 +0000 | [diff] [blame] | 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
Chris Lattner | 3201815 | 2005-06-27 06:28:45 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file defines the ELFWriter class. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
Bill Wendling | 4b2ca1a | 2007-02-08 01:30:50 +0000 | [diff] [blame] | 14 | #ifndef ELFWRITER_H |
| 15 | #define ELFWRITER_H |
Chris Lattner | 3201815 | 2005-06-27 06:28:45 +0000 | [diff] [blame] | 16 | |
Bruno Cardoso Lopes | a029a27 | 2009-06-07 21:22:38 +0000 | [diff] [blame] | 17 | #include "llvm/ADT/SetVector.h" |
Chris Lattner | 3201815 | 2005-06-27 06:28:45 +0000 | [diff] [blame] | 18 | #include "llvm/CodeGen/MachineFunctionPass.h" |
Dan Gohman | c9235d2 | 2008-03-21 23:51:57 +0000 | [diff] [blame] | 19 | #include <map> |
Chris Lattner | 3201815 | 2005-06-27 06:28:45 +0000 | [diff] [blame] | 20 | |
| 21 | namespace llvm { |
Bruno Cardoso Lopes | ae9163f | 2009-06-14 07:53:21 +0000 | [diff] [blame] | 22 | class BinaryObject; |
Bruno Cardoso Lopes | 45f5d64 | 2009-07-02 18:29:24 +0000 | [diff] [blame] | 23 | class Constant; |
Bruno Cardoso Lopes | c997d45 | 2009-06-11 19:16:03 +0000 | [diff] [blame] | 24 | class ConstantStruct; |
| 25 | class ELFCodeEmitter; |
Bruno Cardoso Lopes | 6933d3e | 2009-07-06 09:26:48 +0000 | [diff] [blame] | 26 | class ELFRelocation; |
| 27 | class ELFSection; |
Daniel Dunbar | 89e12a1 | 2009-07-13 06:00:13 +0000 | [diff] [blame] | 28 | struct ELFSym; |
Chris Lattner | 3201815 | 2005-06-27 06:28:45 +0000 | [diff] [blame] | 29 | class GlobalVariable; |
Chris Lattner | 75bbdff | 2005-07-11 03:11:10 +0000 | [diff] [blame] | 30 | class Mangler; |
Chris Lattner | 6871aed | 2005-07-11 05:15:32 +0000 | [diff] [blame] | 31 | class MachineCodeEmitter; |
Bruno Cardoso Lopes | e2b0ecd | 2009-07-18 23:24:01 +0000 | [diff] [blame] | 32 | class MachineConstantPoolEntry; |
Bruno Cardoso Lopes | 6933d3e | 2009-07-06 09:26:48 +0000 | [diff] [blame] | 33 | class ObjectCodeEmitter; |
Bruno Cardoso Lopes | 45f5d64 | 2009-07-02 18:29:24 +0000 | [diff] [blame] | 34 | class TargetAsmInfo; |
| 35 | class TargetELFWriterInfo; |
Owen Anderson | cb37188 | 2008-08-21 00:14:44 +0000 | [diff] [blame] | 36 | class raw_ostream; |
Chris Lattner | 3201815 | 2005-06-27 06:28:45 +0000 | [diff] [blame] | 37 | |
Bruno Cardoso Lopes | 115934e | 2009-07-16 06:26:41 +0000 | [diff] [blame] | 38 | typedef std::vector<ELFSym*>::iterator ELFSymIter; |
| 39 | typedef std::vector<ELFSection*>::iterator ELFSectionIter; |
| 40 | |
Chris Lattner | 3201815 | 2005-06-27 06:28:45 +0000 | [diff] [blame] | 41 | /// ELFWriter - This class implements the common target-independent code for |
| 42 | /// writing ELF files. Targets should derive a class from this to |
| 43 | /// parameterize the output format. |
| 44 | /// |
| 45 | class ELFWriter : public MachineFunctionPass { |
Chris Lattner | 6871aed | 2005-07-11 05:15:32 +0000 | [diff] [blame] | 46 | friend class ELFCodeEmitter; |
| 47 | public: |
Devang Patel | 1997473 | 2007-05-03 01:11:54 +0000 | [diff] [blame] | 48 | static char ID; |
Devang Patel | 794fd75 | 2007-05-01 21:15:47 +0000 | [diff] [blame] | 49 | |
Bruno Cardoso Lopes | 6933d3e | 2009-07-06 09:26:48 +0000 | [diff] [blame] | 50 | /// Return the ELFCodeEmitter as an instance of ObjectCodeEmitter |
| 51 | ObjectCodeEmitter *getObjectCodeEmitter() { |
| 52 | return reinterpret_cast<ObjectCodeEmitter*>(ElfCE); |
Chris Lattner | 6871aed | 2005-07-11 05:15:32 +0000 | [diff] [blame] | 53 | } |
| 54 | |
Owen Anderson | cb37188 | 2008-08-21 00:14:44 +0000 | [diff] [blame] | 55 | ELFWriter(raw_ostream &O, TargetMachine &TM); |
Chris Lattner | 6871aed | 2005-07-11 05:15:32 +0000 | [diff] [blame] | 56 | ~ELFWriter(); |
| 57 | |
Chris Lattner | 3201815 | 2005-06-27 06:28:45 +0000 | [diff] [blame] | 58 | protected: |
Chris Lattner | 3201815 | 2005-06-27 06:28:45 +0000 | [diff] [blame] | 59 | /// Output stream to send the resultant object file to. |
Owen Anderson | cb37188 | 2008-08-21 00:14:44 +0000 | [diff] [blame] | 60 | raw_ostream &O; |
Chris Lattner | 3201815 | 2005-06-27 06:28:45 +0000 | [diff] [blame] | 61 | |
| 62 | /// Target machine description. |
Chris Lattner | 3201815 | 2005-06-27 06:28:45 +0000 | [diff] [blame] | 63 | TargetMachine &TM; |
| 64 | |
Bruno Cardoso Lopes | ae9163f | 2009-06-14 07:53:21 +0000 | [diff] [blame] | 65 | /// Target Elf Writer description. |
| 66 | const TargetELFWriterInfo *TEW; |
| 67 | |
Chris Lattner | 75bbdff | 2005-07-11 03:11:10 +0000 | [diff] [blame] | 68 | /// Mang - The object used to perform name mangling for this module. |
Chris Lattner | 75bbdff | 2005-07-11 03:11:10 +0000 | [diff] [blame] | 69 | Mangler *Mang; |
| 70 | |
Chris Lattner | 6871aed | 2005-07-11 05:15:32 +0000 | [diff] [blame] | 71 | /// MCE - The MachineCodeEmitter object that we are exposing to emit machine |
| 72 | /// code for functions to the .o file. |
Bruno Cardoso Lopes | 6933d3e | 2009-07-06 09:26:48 +0000 | [diff] [blame] | 73 | ELFCodeEmitter *ElfCE; |
Chris Lattner | 6871aed | 2005-07-11 05:15:32 +0000 | [diff] [blame] | 74 | |
Bruno Cardoso Lopes | c997d45 | 2009-06-11 19:16:03 +0000 | [diff] [blame] | 75 | /// TAI - Target Asm Info, provide information about section names for |
| 76 | /// globals and other target specific stuff. |
| 77 | const TargetAsmInfo *TAI; |
| 78 | |
Chris Lattner | 3201815 | 2005-06-27 06:28:45 +0000 | [diff] [blame] | 79 | //===------------------------------------------------------------------===// |
Chris Lattner | 3201815 | 2005-06-27 06:28:45 +0000 | [diff] [blame] | 80 | // Properties inferred automatically from the target machine. |
Bruno Cardoso Lopes | a029a27 | 2009-06-07 21:22:38 +0000 | [diff] [blame] | 81 | //===------------------------------------------------------------------===// |
Chris Lattner | 3201815 | 2005-06-27 06:28:45 +0000 | [diff] [blame] | 82 | |
| 83 | /// is64Bit/isLittleEndian - This information is inferred from the target |
| 84 | /// machine directly, indicating whether to emit a 32- or 64-bit ELF file. |
| 85 | bool is64Bit, isLittleEndian; |
| 86 | |
| 87 | /// doInitialization - Emit the file header and all of the global variables |
| 88 | /// for the module to the ELF file. |
| 89 | bool doInitialization(Module &M); |
Chris Lattner | 3201815 | 2005-06-27 06:28:45 +0000 | [diff] [blame] | 90 | bool runOnMachineFunction(MachineFunction &MF); |
| 91 | |
Chris Lattner | 3201815 | 2005-06-27 06:28:45 +0000 | [diff] [blame] | 92 | /// doFinalization - Now that the module has been completely processed, emit |
| 93 | /// the ELF file to 'O'. |
| 94 | bool doFinalization(Module &M); |
| 95 | |
| 96 | private: |
Bruno Cardoso Lopes | 0d3193e | 2009-06-22 19:16:16 +0000 | [diff] [blame] | 97 | /// Blob containing the Elf header |
Bruno Cardoso Lopes | ae9163f | 2009-06-14 07:53:21 +0000 | [diff] [blame] | 98 | BinaryObject ElfHdr; |
Bruno Cardoso Lopes | a029a27 | 2009-06-07 21:22:38 +0000 | [diff] [blame] | 99 | |
Chris Lattner | 3201815 | 2005-06-27 06:28:45 +0000 | [diff] [blame] | 100 | /// SectionList - This is the list of sections that we have emitted to the |
Bruno Cardoso Lopes | 4b70fab | 2009-07-15 20:49:10 +0000 | [diff] [blame] | 101 | /// file. Once the file has been completely built, the section header table |
Chris Lattner | 3201815 | 2005-06-27 06:28:45 +0000 | [diff] [blame] | 102 | /// is constructed from this info. |
Bruno Cardoso Lopes | 4b70fab | 2009-07-15 20:49:10 +0000 | [diff] [blame] | 103 | std::vector<ELFSection*> SectionList; |
Chris Lattner | 5f48ff7 | 2005-07-16 08:01:13 +0000 | [diff] [blame] | 104 | unsigned NumSections; // Always = SectionList.size() |
| 105 | |
| 106 | /// SectionLookup - This is a mapping from section name to section number in |
Bruno Cardoso Lopes | 4b70fab | 2009-07-15 20:49:10 +0000 | [diff] [blame] | 107 | /// the SectionList. Used to quickly gather the Section Index from TAI names |
Chris Lattner | 5f48ff7 | 2005-07-16 08:01:13 +0000 | [diff] [blame] | 108 | std::map<std::string, ELFSection*> SectionLookup; |
| 109 | |
Bruno Cardoso Lopes | 0d3193e | 2009-06-22 19:16:16 +0000 | [diff] [blame] | 110 | /// GblSymLookup - This is a mapping from global value to a symbol index |
Bruno Cardoso Lopes | 171375f | 2009-07-18 19:30:09 +0000 | [diff] [blame] | 111 | /// in the symbol table or private symbols list. This is useful since reloc |
| 112 | /// symbol references must be quickly mapped to their indices on the lists |
Bruno Cardoso Lopes | 0d3193e | 2009-06-22 19:16:16 +0000 | [diff] [blame] | 113 | std::map<const GlobalValue*, uint32_t> GblSymLookup; |
| 114 | |
Bruno Cardoso Lopes | 4b70fab | 2009-07-15 20:49:10 +0000 | [diff] [blame] | 115 | /// SymbolList - This is the list of symbols emitted to the symbol table. |
| 116 | /// When the SymbolList is finally built, local symbols must be placed in |
| 117 | /// the beginning while non-locals at the end. |
| 118 | std::vector<ELFSym*> SymbolList; |
Bruno Cardoso Lopes | 0d3193e | 2009-06-22 19:16:16 +0000 | [diff] [blame] | 119 | |
Bruno Cardoso Lopes | 171375f | 2009-07-18 19:30:09 +0000 | [diff] [blame] | 120 | /// PrivateSyms - Record private symbols, every symbol here must never be |
| 121 | /// present in the SymbolList. |
| 122 | std::vector<ELFSym*> PrivateSyms; |
| 123 | |
Bruno Cardoso Lopes | 0d3193e | 2009-06-22 19:16:16 +0000 | [diff] [blame] | 124 | /// PendingGlobals - List of externally defined symbols that we have been |
| 125 | /// asked to emit, but have not seen a reference to. When a reference |
| 126 | /// is seen, the symbol will move from this list to the SymbolList. |
| 127 | SetVector<GlobalValue*> PendingGlobals; |
| 128 | |
Bruno Cardoso Lopes | 4b70fab | 2009-07-15 20:49:10 +0000 | [diff] [blame] | 129 | // Remove tab from section name prefix. This is necessary becase TAI |
| 130 | // sometimes return a section name prefixed with elf unused chars. This is |
Bruno Cardoso Lopes | 0b1308f | 2009-07-03 04:36:26 +0000 | [diff] [blame] | 131 | // a little bit dirty. FIXME: find a better approach, maybe add more |
| 132 | // methods to TAI to get the clean name? |
| 133 | void fixNameForSection(std::string &Name) { |
| 134 | size_t Pos = Name.find("\t"); |
| 135 | if (Pos != std::string::npos) |
| 136 | Name.erase(Pos, 1); |
| 137 | |
| 138 | Pos = Name.find(".section "); |
| 139 | if (Pos != std::string::npos) |
| 140 | Name.erase(Pos, 9); |
| 141 | |
| 142 | Pos = Name.find("\n"); |
| 143 | if (Pos != std::string::npos) |
| 144 | Name.erase(Pos, 1); |
| 145 | } |
| 146 | |
Chris Lattner | 5f48ff7 | 2005-07-16 08:01:13 +0000 | [diff] [blame] | 147 | /// getSection - Return the section with the specified name, creating a new |
| 148 | /// section if one does not already exist. |
Bruno Cardoso Lopes | 0d3193e | 2009-06-22 19:16:16 +0000 | [diff] [blame] | 149 | ELFSection &getSection(const std::string &Name, unsigned Type, |
Bruno Cardoso Lopes | c997d45 | 2009-06-11 19:16:03 +0000 | [diff] [blame] | 150 | unsigned Flags = 0, unsigned Align = 0) { |
Bruno Cardoso Lopes | 4b70fab | 2009-07-15 20:49:10 +0000 | [diff] [blame] | 151 | std::string SName(Name); |
| 152 | fixNameForSection(SName); |
Bruno Cardoso Lopes | 0b1308f | 2009-07-03 04:36:26 +0000 | [diff] [blame] | 153 | |
Bruno Cardoso Lopes | 4b70fab | 2009-07-15 20:49:10 +0000 | [diff] [blame] | 154 | ELFSection *&SN = SectionLookup[SName]; |
Bruno Cardoso Lopes | 0b1308f | 2009-07-03 04:36:26 +0000 | [diff] [blame] | 155 | if (SN) return *SN; |
Bruno Cardoso Lopes | 0d3193e | 2009-06-22 19:16:16 +0000 | [diff] [blame] | 156 | |
Bruno Cardoso Lopes | 4b70fab | 2009-07-15 20:49:10 +0000 | [diff] [blame] | 157 | SectionList.push_back(new ELFSection(SName, isLittleEndian, is64Bit)); |
| 158 | SN = SectionList.back(); |
Chris Lattner | 5f48ff7 | 2005-07-16 08:01:13 +0000 | [diff] [blame] | 159 | SN->SectionIdx = NumSections++; |
Chris Lattner | 5f9cb59 | 2005-07-16 17:35:26 +0000 | [diff] [blame] | 160 | SN->Type = Type; |
| 161 | SN->Flags = Flags; |
Bruno Cardoso Lopes | f5b0c5a | 2009-06-06 03:56:29 +0000 | [diff] [blame] | 162 | SN->Link = ELFSection::SHN_UNDEF; |
Bruno Cardoso Lopes | c997d45 | 2009-06-11 19:16:03 +0000 | [diff] [blame] | 163 | SN->Align = Align; |
Chris Lattner | 5f48ff7 | 2005-07-16 08:01:13 +0000 | [diff] [blame] | 164 | return *SN; |
| 165 | } |
Chris Lattner | 3201815 | 2005-06-27 06:28:45 +0000 | [diff] [blame] | 166 | |
Bruno Cardoso Lopes | 0d3193e | 2009-06-22 19:16:16 +0000 | [diff] [blame] | 167 | /// TODO: support mangled names here to emit the right .text section |
| 168 | /// for c++ object files. |
Bruno Cardoso Lopes | 5d41910 | 2009-06-05 00:22:10 +0000 | [diff] [blame] | 169 | ELFSection &getTextSection() { |
Bruno Cardoso Lopes | f5b0c5a | 2009-06-06 03:56:29 +0000 | [diff] [blame] | 170 | return getSection(".text", ELFSection::SHT_PROGBITS, |
| 171 | ELFSection::SHF_EXECINSTR | ELFSection::SHF_ALLOC); |
Bruno Cardoso Lopes | 5d41910 | 2009-06-05 00:22:10 +0000 | [diff] [blame] | 172 | } |
| 173 | |
Bruno Cardoso Lopes | 0d3193e | 2009-06-22 19:16:16 +0000 | [diff] [blame] | 174 | /// Return the relocation section of section 'S'. 'RelA' is true |
| 175 | /// if the relocation section contains entries with addends. |
Bruno Cardoso Lopes | 45f5d64 | 2009-07-02 18:29:24 +0000 | [diff] [blame] | 176 | ELFSection &getRelocSection(std::string SName, bool RelA, unsigned Align) { |
Bruno Cardoso Lopes | 0d3193e | 2009-06-22 19:16:16 +0000 | [diff] [blame] | 177 | std::string RelSName(".rel"); |
| 178 | unsigned SHdrTy = RelA ? ELFSection::SHT_RELA : ELFSection::SHT_REL; |
| 179 | |
| 180 | if (RelA) RelSName.append("a"); |
| 181 | RelSName.append(SName); |
| 182 | |
Bruno Cardoso Lopes | 45f5d64 | 2009-07-02 18:29:24 +0000 | [diff] [blame] | 183 | return getSection(RelSName, SHdrTy, 0, Align); |
Bruno Cardoso Lopes | 0d3193e | 2009-06-22 19:16:16 +0000 | [diff] [blame] | 184 | } |
| 185 | |
Bruno Cardoso Lopes | ae9163f | 2009-06-14 07:53:21 +0000 | [diff] [blame] | 186 | ELFSection &getNonExecStackSection() { |
| 187 | return getSection(".note.GNU-stack", ELFSection::SHT_PROGBITS, 0, 1); |
| 188 | } |
| 189 | |
Bruno Cardoso Lopes | c997d45 | 2009-06-11 19:16:03 +0000 | [diff] [blame] | 190 | ELFSection &getSymbolTableSection() { |
| 191 | return getSection(".symtab", ELFSection::SHT_SYMTAB, 0); |
| 192 | } |
| 193 | |
| 194 | ELFSection &getStringTableSection() { |
| 195 | return getSection(".strtab", ELFSection::SHT_STRTAB, 0, 1); |
| 196 | } |
| 197 | |
Bruno Cardoso Lopes | e39493e | 2009-06-23 04:39:27 +0000 | [diff] [blame] | 198 | ELFSection &getSectionHeaderStringTableSection() { |
| 199 | return getSection(".shstrtab", ELFSection::SHT_STRTAB, 0, 1); |
| 200 | } |
| 201 | |
Chris Lattner | 56c3261 | 2005-07-16 17:40:34 +0000 | [diff] [blame] | 202 | ELFSection &getDataSection() { |
| 203 | return getSection(".data", ELFSection::SHT_PROGBITS, |
Bruno Cardoso Lopes | e39493e | 2009-06-23 04:39:27 +0000 | [diff] [blame] | 204 | ELFSection::SHF_WRITE | ELFSection::SHF_ALLOC, 4); |
Chris Lattner | 56c3261 | 2005-07-16 17:40:34 +0000 | [diff] [blame] | 205 | } |
Bruno Cardoso Lopes | c997d45 | 2009-06-11 19:16:03 +0000 | [diff] [blame] | 206 | |
Chris Lattner | 56c3261 | 2005-07-16 17:40:34 +0000 | [diff] [blame] | 207 | ELFSection &getBSSSection() { |
| 208 | return getSection(".bss", ELFSection::SHT_NOBITS, |
Bruno Cardoso Lopes | e39493e | 2009-06-23 04:39:27 +0000 | [diff] [blame] | 209 | ELFSection::SHF_WRITE | ELFSection::SHF_ALLOC, 4); |
Chris Lattner | 56c3261 | 2005-07-16 17:40:34 +0000 | [diff] [blame] | 210 | } |
| 211 | |
Bruno Cardoso Lopes | 0d3193e | 2009-06-22 19:16:16 +0000 | [diff] [blame] | 212 | ELFSection &getNullSection() { |
| 213 | return getSection("", ELFSection::SHT_NULL, 0); |
| 214 | } |
Bruno Cardoso Lopes | a029a27 | 2009-06-07 21:22:38 +0000 | [diff] [blame] | 215 | |
Bruno Cardoso Lopes | e2b0ecd | 2009-07-18 23:24:01 +0000 | [diff] [blame] | 216 | ELFSection &getJumpTableSection(); |
| 217 | ELFSection &getConstantPoolSection(MachineConstantPoolEntry &CPE); |
| 218 | |
Bruno Cardoso Lopes | 0b1308f | 2009-07-03 04:36:26 +0000 | [diff] [blame] | 219 | // Helpers for obtaining ELF specific info. |
Bruno Cardoso Lopes | d291066 | 2009-07-13 22:40:39 +0000 | [diff] [blame] | 220 | unsigned getGlobalELFBinding(const GlobalValue *GV); |
| 221 | unsigned getGlobalELFType(const GlobalValue *GV); |
Bruno Cardoso Lopes | 45f5d64 | 2009-07-02 18:29:24 +0000 | [diff] [blame] | 222 | unsigned getGlobalELFVisibility(const GlobalValue *GV); |
Bruno Cardoso Lopes | 0b1308f | 2009-07-03 04:36:26 +0000 | [diff] [blame] | 223 | unsigned getElfSectionFlags(unsigned Flags); |
Bruno Cardoso Lopes | 45f5d64 | 2009-07-02 18:29:24 +0000 | [diff] [blame] | 224 | |
Chris Lattner | 5f48ff7 | 2005-07-16 08:01:13 +0000 | [diff] [blame] | 225 | // As we complete the ELF file, we need to update fields in the ELF header |
| 226 | // (e.g. the location of the section table). These members keep track of |
| 227 | // the offset in ELFHeader of these various pieces to update and other |
| 228 | // locations in the file. |
Bruno Cardoso Lopes | f5b0c5a | 2009-06-06 03:56:29 +0000 | [diff] [blame] | 229 | unsigned ELFHdr_e_shoff_Offset; // e_shoff in ELF header. |
| 230 | unsigned ELFHdr_e_shstrndx_Offset; // e_shstrndx in ELF header. |
| 231 | unsigned ELFHdr_e_shnum_Offset; // e_shnum in ELF header. |
Bruno Cardoso Lopes | ae9163f | 2009-06-14 07:53:21 +0000 | [diff] [blame] | 232 | |
Chris Lattner | 3201815 | 2005-06-27 06:28:45 +0000 | [diff] [blame] | 233 | private: |
Bruno Cardoso Lopes | d291066 | 2009-07-13 22:40:39 +0000 | [diff] [blame] | 234 | void EmitGlobal(const GlobalValue *GV); |
Bruno Cardoso Lopes | ae9163f | 2009-06-14 07:53:21 +0000 | [diff] [blame] | 235 | void EmitGlobalConstant(const Constant *C, ELFSection &GblS); |
Bruno Cardoso Lopes | c997d45 | 2009-06-11 19:16:03 +0000 | [diff] [blame] | 236 | void EmitGlobalConstantStruct(const ConstantStruct *CVS, |
Bruno Cardoso Lopes | ae9163f | 2009-06-14 07:53:21 +0000 | [diff] [blame] | 237 | ELFSection &GblS); |
Bruno Cardoso Lopes | 0d3193e | 2009-06-22 19:16:16 +0000 | [diff] [blame] | 238 | ELFSection &getGlobalSymELFSection(const GlobalVariable *GV, ELFSym &Sym); |
Bruno Cardoso Lopes | a029a27 | 2009-06-07 21:22:38 +0000 | [diff] [blame] | 239 | void EmitRelocations(); |
Bruno Cardoso Lopes | 0d3193e | 2009-06-22 19:16:16 +0000 | [diff] [blame] | 240 | void EmitRelocation(BinaryObject &RelSec, ELFRelocation &Rel, bool HasRelA); |
Bruno Cardoso Lopes | ae9163f | 2009-06-14 07:53:21 +0000 | [diff] [blame] | 241 | void EmitSectionHeader(BinaryObject &SHdrTab, const ELFSection &SHdr); |
Chris Lattner | 3201815 | 2005-06-27 06:28:45 +0000 | [diff] [blame] | 242 | void EmitSectionTableStringTable(); |
Bruno Cardoso Lopes | ae9163f | 2009-06-14 07:53:21 +0000 | [diff] [blame] | 243 | void EmitSymbol(BinaryObject &SymbolTable, ELFSym &Sym); |
Bruno Cardoso Lopes | c997d45 | 2009-06-11 19:16:03 +0000 | [diff] [blame] | 244 | void EmitSymbolTable(); |
Bruno Cardoso Lopes | c236a34 | 2009-06-22 19:29:56 +0000 | [diff] [blame] | 245 | void EmitStringTable(); |
Chris Lattner | 5f48ff7 | 2005-07-16 08:01:13 +0000 | [diff] [blame] | 246 | void OutputSectionsAndSectionTable(); |
Bruno Cardoso Lopes | 4b70fab | 2009-07-15 20:49:10 +0000 | [diff] [blame] | 247 | unsigned SortSymbols(); |
Chris Lattner | 3201815 | 2005-06-27 06:28:45 +0000 | [diff] [blame] | 248 | }; |
| 249 | } |
| 250 | |
| 251 | #endif |