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 | 3e0094d | 2009-08-08 17:29:04 +0000 | [diff] [blame] | 24 | class ConstantInt; |
Bruno Cardoso Lopes | c997d45 | 2009-06-11 19:16:03 +0000 | [diff] [blame] | 25 | class ConstantStruct; |
| 26 | class ELFCodeEmitter; |
Bruno Cardoso Lopes | 6933d3e | 2009-07-06 09:26:48 +0000 | [diff] [blame] | 27 | class ELFRelocation; |
| 28 | class ELFSection; |
Daniel Dunbar | 89e12a1 | 2009-07-13 06:00:13 +0000 | [diff] [blame] | 29 | struct ELFSym; |
Chris Lattner | 3201815 | 2005-06-27 06:28:45 +0000 | [diff] [blame] | 30 | class GlobalVariable; |
Chris Lattner | 75bbdff | 2005-07-11 03:11:10 +0000 | [diff] [blame] | 31 | class Mangler; |
Chris Lattner | 6871aed | 2005-07-11 05:15:32 +0000 | [diff] [blame] | 32 | class MachineCodeEmitter; |
Bruno Cardoso Lopes | e2b0ecd | 2009-07-18 23:24:01 +0000 | [diff] [blame] | 33 | class MachineConstantPoolEntry; |
Bruno Cardoso Lopes | 6933d3e | 2009-07-06 09:26:48 +0000 | [diff] [blame] | 34 | class ObjectCodeEmitter; |
Bruno Cardoso Lopes | 45f5d64 | 2009-07-02 18:29:24 +0000 | [diff] [blame] | 35 | class TargetAsmInfo; |
| 36 | class TargetELFWriterInfo; |
Bruno Cardoso Lopes | 52d0851 | 2009-08-05 06:57:03 +0000 | [diff] [blame] | 37 | class TargetLoweringObjectFile; |
Owen Anderson | cb37188 | 2008-08-21 00:14:44 +0000 | [diff] [blame] | 38 | class raw_ostream; |
Chris Lattner | 5fe575f | 2009-07-27 05:32:16 +0000 | [diff] [blame] | 39 | class SectionKind; |
Chris Lattner | f26e03b | 2009-07-31 17:42:42 +0000 | [diff] [blame] | 40 | class MCContext; |
Chris Lattner | 3201815 | 2005-06-27 06:28:45 +0000 | [diff] [blame] | 41 | |
Bruno Cardoso Lopes | 115934e | 2009-07-16 06:26:41 +0000 | [diff] [blame] | 42 | typedef std::vector<ELFSym*>::iterator ELFSymIter; |
| 43 | typedef std::vector<ELFSection*>::iterator ELFSectionIter; |
Bruno Cardoso Lopes | 746e3bb | 2009-07-27 18:54:47 +0000 | [diff] [blame] | 44 | typedef SetVector<const GlobalValue*>::const_iterator PendingGblsIter; |
| 45 | typedef SetVector<const char *>::const_iterator PendingExtsIter; |
Bruno Cardoso Lopes | 64a6b39 | 2009-08-10 03:32:40 +0000 | [diff] [blame] | 46 | typedef std::pair<const Constant *, int64_t> CstExprResTy; |
Bruno Cardoso Lopes | 115934e | 2009-07-16 06:26:41 +0000 | [diff] [blame] | 47 | |
Chris Lattner | 3201815 | 2005-06-27 06:28:45 +0000 | [diff] [blame] | 48 | /// ELFWriter - This class implements the common target-independent code for |
| 49 | /// writing ELF files. Targets should derive a class from this to |
| 50 | /// parameterize the output format. |
| 51 | /// |
| 52 | class ELFWriter : public MachineFunctionPass { |
Chris Lattner | 6871aed | 2005-07-11 05:15:32 +0000 | [diff] [blame] | 53 | friend class ELFCodeEmitter; |
| 54 | public: |
Devang Patel | 1997473 | 2007-05-03 01:11:54 +0000 | [diff] [blame] | 55 | static char ID; |
Devang Patel | 794fd75 | 2007-05-01 21:15:47 +0000 | [diff] [blame] | 56 | |
Bruno Cardoso Lopes | 6933d3e | 2009-07-06 09:26:48 +0000 | [diff] [blame] | 57 | /// Return the ELFCodeEmitter as an instance of ObjectCodeEmitter |
| 58 | ObjectCodeEmitter *getObjectCodeEmitter() { |
| 59 | return reinterpret_cast<ObjectCodeEmitter*>(ElfCE); |
Chris Lattner | 6871aed | 2005-07-11 05:15:32 +0000 | [diff] [blame] | 60 | } |
| 61 | |
Owen Anderson | cb37188 | 2008-08-21 00:14:44 +0000 | [diff] [blame] | 62 | ELFWriter(raw_ostream &O, TargetMachine &TM); |
Chris Lattner | 6871aed | 2005-07-11 05:15:32 +0000 | [diff] [blame] | 63 | ~ELFWriter(); |
| 64 | |
Chris Lattner | 3201815 | 2005-06-27 06:28:45 +0000 | [diff] [blame] | 65 | protected: |
Chris Lattner | 3201815 | 2005-06-27 06:28:45 +0000 | [diff] [blame] | 66 | /// Output stream to send the resultant object file to. |
Owen Anderson | cb37188 | 2008-08-21 00:14:44 +0000 | [diff] [blame] | 67 | raw_ostream &O; |
Chris Lattner | 3201815 | 2005-06-27 06:28:45 +0000 | [diff] [blame] | 68 | |
| 69 | /// Target machine description. |
Chris Lattner | 3201815 | 2005-06-27 06:28:45 +0000 | [diff] [blame] | 70 | TargetMachine &TM; |
| 71 | |
Bruno Cardoso Lopes | 52d0851 | 2009-08-05 06:57:03 +0000 | [diff] [blame] | 72 | /// Context object for machine code objects. |
Chris Lattner | f26e03b | 2009-07-31 17:42:42 +0000 | [diff] [blame] | 73 | MCContext &OutContext; |
| 74 | |
Bruno Cardoso Lopes | ae9163f | 2009-06-14 07:53:21 +0000 | [diff] [blame] | 75 | /// Target Elf Writer description. |
| 76 | const TargetELFWriterInfo *TEW; |
| 77 | |
Chris Lattner | 75bbdff | 2005-07-11 03:11:10 +0000 | [diff] [blame] | 78 | /// Mang - The object used to perform name mangling for this module. |
Chris Lattner | 75bbdff | 2005-07-11 03:11:10 +0000 | [diff] [blame] | 79 | Mangler *Mang; |
| 80 | |
Chris Lattner | 6871aed | 2005-07-11 05:15:32 +0000 | [diff] [blame] | 81 | /// MCE - The MachineCodeEmitter object that we are exposing to emit machine |
| 82 | /// code for functions to the .o file. |
Bruno Cardoso Lopes | 6933d3e | 2009-07-06 09:26:48 +0000 | [diff] [blame] | 83 | ELFCodeEmitter *ElfCE; |
Chris Lattner | 6871aed | 2005-07-11 05:15:32 +0000 | [diff] [blame] | 84 | |
Bruno Cardoso Lopes | 52d0851 | 2009-08-05 06:57:03 +0000 | [diff] [blame] | 85 | /// TLOF - Target Lowering Object File, provide section names for globals |
| 86 | /// and other object file specific stuff |
| 87 | const TargetLoweringObjectFile &TLOF; |
| 88 | |
Bruno Cardoso Lopes | c997d45 | 2009-06-11 19:16:03 +0000 | [diff] [blame] | 89 | /// TAI - Target Asm Info, provide information about section names for |
| 90 | /// globals and other target specific stuff. |
| 91 | const TargetAsmInfo *TAI; |
| 92 | |
Chris Lattner | 3201815 | 2005-06-27 06:28:45 +0000 | [diff] [blame] | 93 | //===------------------------------------------------------------------===// |
Chris Lattner | 3201815 | 2005-06-27 06:28:45 +0000 | [diff] [blame] | 94 | // Properties inferred automatically from the target machine. |
Bruno Cardoso Lopes | a029a27 | 2009-06-07 21:22:38 +0000 | [diff] [blame] | 95 | //===------------------------------------------------------------------===// |
Chris Lattner | 3201815 | 2005-06-27 06:28:45 +0000 | [diff] [blame] | 96 | |
| 97 | /// is64Bit/isLittleEndian - This information is inferred from the target |
| 98 | /// machine directly, indicating whether to emit a 32- or 64-bit ELF file. |
| 99 | bool is64Bit, isLittleEndian; |
| 100 | |
| 101 | /// doInitialization - Emit the file header and all of the global variables |
| 102 | /// for the module to the ELF file. |
| 103 | bool doInitialization(Module &M); |
Chris Lattner | 3201815 | 2005-06-27 06:28:45 +0000 | [diff] [blame] | 104 | bool runOnMachineFunction(MachineFunction &MF); |
| 105 | |
Chris Lattner | 3201815 | 2005-06-27 06:28:45 +0000 | [diff] [blame] | 106 | /// doFinalization - Now that the module has been completely processed, emit |
| 107 | /// the ELF file to 'O'. |
| 108 | bool doFinalization(Module &M); |
| 109 | |
| 110 | private: |
Bruno Cardoso Lopes | 0d3193e | 2009-06-22 19:16:16 +0000 | [diff] [blame] | 111 | /// Blob containing the Elf header |
Bruno Cardoso Lopes | ae9163f | 2009-06-14 07:53:21 +0000 | [diff] [blame] | 112 | BinaryObject ElfHdr; |
Bruno Cardoso Lopes | a029a27 | 2009-06-07 21:22:38 +0000 | [diff] [blame] | 113 | |
Chris Lattner | 3201815 | 2005-06-27 06:28:45 +0000 | [diff] [blame] | 114 | /// 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] | 115 | /// file. Once the file has been completely built, the section header table |
Chris Lattner | 3201815 | 2005-06-27 06:28:45 +0000 | [diff] [blame] | 116 | /// is constructed from this info. |
Bruno Cardoso Lopes | 4b70fab | 2009-07-15 20:49:10 +0000 | [diff] [blame] | 117 | std::vector<ELFSection*> SectionList; |
Chris Lattner | 5f48ff7 | 2005-07-16 08:01:13 +0000 | [diff] [blame] | 118 | unsigned NumSections; // Always = SectionList.size() |
| 119 | |
| 120 | /// 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] | 121 | /// the SectionList. Used to quickly gather the Section Index from TAI names |
Chris Lattner | 5f48ff7 | 2005-07-16 08:01:13 +0000 | [diff] [blame] | 122 | std::map<std::string, ELFSection*> SectionLookup; |
| 123 | |
Bruno Cardoso Lopes | 746e3bb | 2009-07-27 18:54:47 +0000 | [diff] [blame] | 124 | /// PendingGlobals - Globals not processed as symbols yet. |
| 125 | SetVector<const GlobalValue*> PendingGlobals; |
| 126 | |
Bruno Cardoso Lopes | 0d3193e | 2009-06-22 19:16:16 +0000 | [diff] [blame] | 127 | /// 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] | 128 | /// in the symbol table or private symbols list. This is useful since reloc |
Bruno Cardoso Lopes | 746e3bb | 2009-07-27 18:54:47 +0000 | [diff] [blame] | 129 | /// 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] | 130 | std::map<const GlobalValue*, uint32_t> GblSymLookup; |
| 131 | |
Bruno Cardoso Lopes | 746e3bb | 2009-07-27 18:54:47 +0000 | [diff] [blame] | 132 | /// PendingExternals - Externals not processed as symbols yet. |
| 133 | SetVector<const char *> PendingExternals; |
| 134 | |
| 135 | /// ExtSymLookup - This is a mapping from externals to a symbol index |
| 136 | /// in the symbol table list. This is useful since reloc symbol references |
| 137 | /// must be quickly mapped to their symbol table indices. |
| 138 | std::map<const char *, uint32_t> ExtSymLookup; |
| 139 | |
Bruno Cardoso Lopes | 4b70fab | 2009-07-15 20:49:10 +0000 | [diff] [blame] | 140 | /// SymbolList - This is the list of symbols emitted to the symbol table. |
| 141 | /// When the SymbolList is finally built, local symbols must be placed in |
| 142 | /// the beginning while non-locals at the end. |
| 143 | std::vector<ELFSym*> SymbolList; |
Bruno Cardoso Lopes | 0d3193e | 2009-06-22 19:16:16 +0000 | [diff] [blame] | 144 | |
Bruno Cardoso Lopes | 171375f | 2009-07-18 19:30:09 +0000 | [diff] [blame] | 145 | /// PrivateSyms - Record private symbols, every symbol here must never be |
| 146 | /// present in the SymbolList. |
| 147 | std::vector<ELFSym*> PrivateSyms; |
| 148 | |
Chris Lattner | 5f48ff7 | 2005-07-16 08:01:13 +0000 | [diff] [blame] | 149 | /// getSection - Return the section with the specified name, creating a new |
| 150 | /// section if one does not already exist. |
Bruno Cardoso Lopes | 0d3193e | 2009-06-22 19:16:16 +0000 | [diff] [blame] | 151 | ELFSection &getSection(const std::string &Name, unsigned Type, |
Bruno Cardoso Lopes | c997d45 | 2009-06-11 19:16:03 +0000 | [diff] [blame] | 152 | unsigned Flags = 0, unsigned Align = 0) { |
Bruno Cardoso Lopes | d163e8b | 2009-08-13 21:25:27 +0000 | [diff] [blame^] | 153 | ELFSection *&SN = SectionLookup[Name]; |
Bruno Cardoso Lopes | 0b1308f | 2009-07-03 04:36:26 +0000 | [diff] [blame] | 154 | if (SN) return *SN; |
Bruno Cardoso Lopes | 0d3193e | 2009-06-22 19:16:16 +0000 | [diff] [blame] | 155 | |
Bruno Cardoso Lopes | d163e8b | 2009-08-13 21:25:27 +0000 | [diff] [blame^] | 156 | SectionList.push_back(new ELFSection(Name, isLittleEndian, is64Bit)); |
Bruno Cardoso Lopes | 4b70fab | 2009-07-15 20:49:10 +0000 | [diff] [blame] | 157 | SN = SectionList.back(); |
Chris Lattner | 5f48ff7 | 2005-07-16 08:01:13 +0000 | [diff] [blame] | 158 | SN->SectionIdx = NumSections++; |
Chris Lattner | 5f9cb59 | 2005-07-16 17:35:26 +0000 | [diff] [blame] | 159 | SN->Type = Type; |
| 160 | SN->Flags = Flags; |
Bruno Cardoso Lopes | f5b0c5a | 2009-06-06 03:56:29 +0000 | [diff] [blame] | 161 | SN->Link = ELFSection::SHN_UNDEF; |
Bruno Cardoso Lopes | c997d45 | 2009-06-11 19:16:03 +0000 | [diff] [blame] | 162 | SN->Align = Align; |
Chris Lattner | 5f48ff7 | 2005-07-16 08:01:13 +0000 | [diff] [blame] | 163 | return *SN; |
| 164 | } |
Chris Lattner | 3201815 | 2005-06-27 06:28:45 +0000 | [diff] [blame] | 165 | |
Bruno Cardoso Lopes | ae9163f | 2009-06-14 07:53:21 +0000 | [diff] [blame] | 166 | ELFSection &getNonExecStackSection() { |
| 167 | return getSection(".note.GNU-stack", ELFSection::SHT_PROGBITS, 0, 1); |
| 168 | } |
| 169 | |
Bruno Cardoso Lopes | c997d45 | 2009-06-11 19:16:03 +0000 | [diff] [blame] | 170 | ELFSection &getSymbolTableSection() { |
| 171 | return getSection(".symtab", ELFSection::SHT_SYMTAB, 0); |
| 172 | } |
| 173 | |
| 174 | ELFSection &getStringTableSection() { |
| 175 | return getSection(".strtab", ELFSection::SHT_STRTAB, 0, 1); |
| 176 | } |
| 177 | |
Bruno Cardoso Lopes | e39493e | 2009-06-23 04:39:27 +0000 | [diff] [blame] | 178 | ELFSection &getSectionHeaderStringTableSection() { |
| 179 | return getSection(".shstrtab", ELFSection::SHT_STRTAB, 0, 1); |
| 180 | } |
| 181 | |
Bruno Cardoso Lopes | 0d3193e | 2009-06-22 19:16:16 +0000 | [diff] [blame] | 182 | ELFSection &getNullSection() { |
| 183 | return getSection("", ELFSection::SHT_NULL, 0); |
| 184 | } |
Bruno Cardoso Lopes | a029a27 | 2009-06-07 21:22:38 +0000 | [diff] [blame] | 185 | |
Bruno Cardoso Lopes | d163e8b | 2009-08-13 21:25:27 +0000 | [diff] [blame^] | 186 | ELFSection &getDataSection(); |
| 187 | ELFSection &getBSSSection(); |
Bruno Cardoso Lopes | 52d0851 | 2009-08-05 06:57:03 +0000 | [diff] [blame] | 188 | ELFSection &getCtorSection(); |
| 189 | ELFSection &getDtorSection(); |
Bruno Cardoso Lopes | e2b0ecd | 2009-07-18 23:24:01 +0000 | [diff] [blame] | 190 | ELFSection &getJumpTableSection(); |
| 191 | ELFSection &getConstantPoolSection(MachineConstantPoolEntry &CPE); |
Bruno Cardoso Lopes | 52d0851 | 2009-08-05 06:57:03 +0000 | [diff] [blame] | 192 | ELFSection &getTextSection(Function *F); |
Bruno Cardoso Lopes | 0a38dc5 | 2009-07-20 08:52:02 +0000 | [diff] [blame] | 193 | ELFSection &getRelocSection(ELFSection &S); |
Bruno Cardoso Lopes | e2b0ecd | 2009-07-18 23:24:01 +0000 | [diff] [blame] | 194 | |
Bruno Cardoso Lopes | 0b1308f | 2009-07-03 04:36:26 +0000 | [diff] [blame] | 195 | // Helpers for obtaining ELF specific info. |
Bruno Cardoso Lopes | d291066 | 2009-07-13 22:40:39 +0000 | [diff] [blame] | 196 | unsigned getGlobalELFBinding(const GlobalValue *GV); |
| 197 | unsigned getGlobalELFType(const GlobalValue *GV); |
Bruno Cardoso Lopes | 45f5d64 | 2009-07-02 18:29:24 +0000 | [diff] [blame] | 198 | unsigned getGlobalELFVisibility(const GlobalValue *GV); |
| 199 | |
Bruno Cardoso Lopes | d163e8b | 2009-08-13 21:25:27 +0000 | [diff] [blame^] | 200 | // AddPendingGlobalSymbol - Add a global to be processed and to |
| 201 | // the global symbol lookup, use a zero index because the table |
Bruno Cardoso Lopes | 52d0851 | 2009-08-05 06:57:03 +0000 | [diff] [blame] | 202 | // index will be determined later. |
Bruno Cardoso Lopes | d163e8b | 2009-08-13 21:25:27 +0000 | [diff] [blame^] | 203 | void AddPendingGlobalSymbol(const GlobalValue *GV, |
| 204 | bool AddToLookup = false); |
Bruno Cardoso Lopes | 52d0851 | 2009-08-05 06:57:03 +0000 | [diff] [blame] | 205 | |
Bruno Cardoso Lopes | d163e8b | 2009-08-13 21:25:27 +0000 | [diff] [blame^] | 206 | // AddPendingExternalSymbol - Add the external to be processed |
| 207 | // and to the external symbol lookup, use a zero index because |
| 208 | // the symbol table index will be determined later. |
| 209 | void AddPendingExternalSymbol(const char *External); |
| 210 | |
| 211 | // AddToSymbolList - Update the symbol lookup and If the symbol is |
| 212 | // private add it to PrivateSyms list, otherwise to SymbolList. |
| 213 | void AddToSymbolList(ELFSym *GblSym); |
Bruno Cardoso Lopes | 68491c1 | 2009-07-21 06:51:32 +0000 | [diff] [blame] | 214 | |
Chris Lattner | 5f48ff7 | 2005-07-16 08:01:13 +0000 | [diff] [blame] | 215 | // As we complete the ELF file, we need to update fields in the ELF header |
| 216 | // (e.g. the location of the section table). These members keep track of |
| 217 | // the offset in ELFHeader of these various pieces to update and other |
| 218 | // locations in the file. |
Bruno Cardoso Lopes | f5b0c5a | 2009-06-06 03:56:29 +0000 | [diff] [blame] | 219 | unsigned ELFHdr_e_shoff_Offset; // e_shoff in ELF header. |
| 220 | unsigned ELFHdr_e_shstrndx_Offset; // e_shstrndx in ELF header. |
| 221 | unsigned ELFHdr_e_shnum_Offset; // e_shnum in ELF header. |
Bruno Cardoso Lopes | ae9163f | 2009-06-14 07:53:21 +0000 | [diff] [blame] | 222 | |
Chris Lattner | 3201815 | 2005-06-27 06:28:45 +0000 | [diff] [blame] | 223 | private: |
Bruno Cardoso Lopes | d291066 | 2009-07-13 22:40:39 +0000 | [diff] [blame] | 224 | void EmitGlobal(const GlobalValue *GV); |
Bruno Cardoso Lopes | ae9163f | 2009-06-14 07:53:21 +0000 | [diff] [blame] | 225 | void EmitGlobalConstant(const Constant *C, ELFSection &GblS); |
Bruno Cardoso Lopes | c997d45 | 2009-06-11 19:16:03 +0000 | [diff] [blame] | 226 | void EmitGlobalConstantStruct(const ConstantStruct *CVS, |
Bruno Cardoso Lopes | ae9163f | 2009-06-14 07:53:21 +0000 | [diff] [blame] | 227 | ELFSection &GblS); |
Bruno Cardoso Lopes | 3e0094d | 2009-08-08 17:29:04 +0000 | [diff] [blame] | 228 | void EmitGlobalConstantLargeInt(const ConstantInt *CI, ELFSection &S); |
| 229 | void EmitGlobalDataRelocation(const GlobalValue *GV, unsigned Size, |
Bruno Cardoso Lopes | 64a6b39 | 2009-08-10 03:32:40 +0000 | [diff] [blame] | 230 | ELFSection &GblS, int64_t Offset = 0); |
Bruno Cardoso Lopes | 52d0851 | 2009-08-05 06:57:03 +0000 | [diff] [blame] | 231 | bool EmitSpecialLLVMGlobal(const GlobalVariable *GV); |
| 232 | void EmitXXStructorList(Constant *List, ELFSection &Xtor); |
Bruno Cardoso Lopes | a029a27 | 2009-06-07 21:22:38 +0000 | [diff] [blame] | 233 | void EmitRelocations(); |
Bruno Cardoso Lopes | 0d3193e | 2009-06-22 19:16:16 +0000 | [diff] [blame] | 234 | void EmitRelocation(BinaryObject &RelSec, ELFRelocation &Rel, bool HasRelA); |
Bruno Cardoso Lopes | ae9163f | 2009-06-14 07:53:21 +0000 | [diff] [blame] | 235 | void EmitSectionHeader(BinaryObject &SHdrTab, const ELFSection &SHdr); |
Chris Lattner | 3201815 | 2005-06-27 06:28:45 +0000 | [diff] [blame] | 236 | void EmitSectionTableStringTable(); |
Bruno Cardoso Lopes | ae9163f | 2009-06-14 07:53:21 +0000 | [diff] [blame] | 237 | void EmitSymbol(BinaryObject &SymbolTable, ELFSym &Sym); |
Bruno Cardoso Lopes | c997d45 | 2009-06-11 19:16:03 +0000 | [diff] [blame] | 238 | void EmitSymbolTable(); |
Bruno Cardoso Lopes | df0b650 | 2009-07-27 19:32:57 +0000 | [diff] [blame] | 239 | void EmitStringTable(const std::string &ModuleName); |
Chris Lattner | 5f48ff7 | 2005-07-16 08:01:13 +0000 | [diff] [blame] | 240 | void OutputSectionsAndSectionTable(); |
Bruno Cardoso Lopes | 0a38dc5 | 2009-07-20 08:52:02 +0000 | [diff] [blame] | 241 | void RelocateField(BinaryObject &BO, uint32_t Offset, int64_t Value, |
| 242 | unsigned Size); |
Bruno Cardoso Lopes | 4b70fab | 2009-07-15 20:49:10 +0000 | [diff] [blame] | 243 | unsigned SortSymbols(); |
Bruno Cardoso Lopes | 64a6b39 | 2009-08-10 03:32:40 +0000 | [diff] [blame] | 244 | CstExprResTy ResolveConstantExpr(const Constant *CV); |
Chris Lattner | 3201815 | 2005-06-27 06:28:45 +0000 | [diff] [blame] | 245 | }; |
| 246 | } |
| 247 | |
| 248 | #endif |