| OLD | NEW |
| 1 //===- subzero/src/IceELFObjectWriter.h - ELF object writer -----*- C++ -*-===// | 1 //===- subzero/src/IceELFObjectWriter.h - ELF object writer -----*- C++ -*-===// |
| 2 // | 2 // |
| 3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
| 4 // | 4 // |
| 5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
| 6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
| 7 // | 7 // |
| 8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
| 9 /// | 9 /// |
| 10 /// \file | 10 /// \file |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 /// Write the initial ELF header. This is just to reserve space in the ELF | 55 /// Write the initial ELF header. This is just to reserve space in the ELF |
| 56 /// file. Reserving space allows the other functions to write text and data | 56 /// file. Reserving space allows the other functions to write text and data |
| 57 /// directly to the file and get the right file offsets. | 57 /// directly to the file and get the right file offsets. |
| 58 void writeInitialELFHeader(); | 58 void writeInitialELFHeader(); |
| 59 | 59 |
| 60 /// Copy initializer data for globals to file and note the offset and size of | 60 /// Copy initializer data for globals to file and note the offset and size of |
| 61 /// each global's definition in the symbol table. Use the given target's | 61 /// each global's definition in the symbol table. Use the given target's |
| 62 /// RelocationKind for any relocations. | 62 /// RelocationKind for any relocations. |
| 63 void writeDataSection(const VariableDeclarationList &Vars, | 63 void writeDataSection(const VariableDeclarationList &Vars, |
| 64 FixupKind RelocationKind, | 64 FixupKind RelocationKind, |
| 65 const IceString &SectionSuffix); | 65 const IceString &SectionSuffix, bool IsPIC); |
| 66 | 66 |
| 67 /// Copy data of a function's text section to file and note the offset of the | 67 /// Copy data of a function's text section to file and note the offset of the |
| 68 /// symbol's definition in the symbol table. Copy the text fixups for use | 68 /// symbol's definition in the symbol table. Copy the text fixups for use |
| 69 /// after all functions are written. The text buffer and fixups are extracted | 69 /// after all functions are written. The text buffer and fixups are extracted |
| 70 /// from the Assembler object. | 70 /// from the Assembler object. |
| 71 void writeFunctionCode(const IceString &FuncName, bool IsInternal, | 71 void writeFunctionCode(const IceString &FuncName, bool IsInternal, |
| 72 const Assembler *Asm); | 72 const Assembler *Asm); |
| 73 | 73 |
| 74 /// Queries the GlobalContext for constant pools of the given type and writes | 74 /// Queries the GlobalContext for constant pools of the given type and writes |
| 75 /// out read-only data sections for those constants. This also fills the | 75 /// out read-only data sections for those constants. This also fills the |
| 76 /// symbol table with labels for each constant pool entry. | 76 /// symbol table with labels for each constant pool entry. |
| 77 template <typename ConstType> void writeConstantPool(Type Ty); | 77 template <typename ConstType> void writeConstantPool(Type Ty); |
| 78 | 78 |
| 79 /// Write a jump table and register fixups for the target addresses. | 79 /// Write a jump table and register fixups for the target addresses. |
| 80 void writeJumpTable(const JumpTableData &JT, FixupKind RelocationKind); | 80 void writeJumpTable(const JumpTableData &JT, FixupKind RelocationKind, |
| 81 bool IsPIC); |
| 81 | 82 |
| 82 /// Populate the symbol table with a list of external/undefined symbols. | 83 /// Populate the symbol table with a list of external/undefined symbols. |
| 83 void setUndefinedSyms(const ConstantList &UndefSyms); | 84 void setUndefinedSyms(const ConstantList &UndefSyms); |
| 84 | 85 |
| 85 /// Do final layout and write out the rest of the object file. Finally, patch | 86 /// Do final layout and write out the rest of the object file. Finally, patch |
| 86 /// up the initial ELF header with the final info. | 87 /// up the initial ELF header with the final info. |
| 87 void writeNonUserSections(); | 88 void writeNonUserSections(); |
| 88 | 89 |
| 89 /// Which type of ELF section a global variable initializer belongs to. This | 90 /// Which type of ELF section a global variable initializer belongs to. This |
| 90 /// is used as an array index so should start at 0 and be contiguous. | 91 /// is used as an array index so should start at 0 and be contiguous. |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 SectionList &AllSections); | 147 SectionList &AllSections); |
| 147 | 148 |
| 148 /// Link the relocation sections to the symbol table. | 149 /// Link the relocation sections to the symbol table. |
| 149 void assignRelLinkNum(SizeT SymTabNumber, RelSectionList &RelSections); | 150 void assignRelLinkNum(SizeT SymTabNumber, RelSectionList &RelSections); |
| 150 | 151 |
| 151 /// Helper function for writeDataSection. Writes a data section of type | 152 /// Helper function for writeDataSection. Writes a data section of type |
| 152 /// SectionType, given the global variables Vars belonging to that | 153 /// SectionType, given the global variables Vars belonging to that |
| 153 /// SectionType. | 154 /// SectionType. |
| 154 void writeDataOfType(SectionType SectionType, | 155 void writeDataOfType(SectionType SectionType, |
| 155 const VariableDeclarationList &Vars, | 156 const VariableDeclarationList &Vars, |
| 156 FixupKind RelocationKind, | 157 FixupKind RelocationKind, const IceString &SectionSuffix, |
| 157 const IceString &SectionSuffix); | 158 bool IsPIC); |
| 158 | 159 |
| 159 /// Write the final relocation sections given the final symbol table. May also | 160 /// Write the final relocation sections given the final symbol table. May also |
| 160 /// be able to seek around the file and resolve function calls that are for | 161 /// be able to seek around the file and resolve function calls that are for |
| 161 /// functions within the same section. | 162 /// functions within the same section. |
| 162 void writeAllRelocationSections(); | 163 void writeAllRelocationSections(); |
| 163 void writeRelocationSections(RelSectionList &RelSections); | 164 void writeRelocationSections(RelSectionList &RelSections); |
| 164 | 165 |
| 165 /// Write the ELF file header with the given information about sections. | 166 /// Write the ELF file header with the given information about sections. |
| 166 template <bool IsELF64> | 167 template <bool IsELF64> |
| 167 void writeELFHeaderInternal(Elf64_Off SectionHeaderOffset, | 168 void writeELFHeaderInternal(Elf64_Off SectionHeaderOffset, |
| 168 SizeT SectHeaderStrIndex, SizeT NumSections); | 169 SizeT SectHeaderStrIndex, SizeT NumSections); |
| 169 }; | 170 }; |
| 170 | 171 |
| 171 } // end of namespace Ice | 172 } // end of namespace Ice |
| 172 | 173 |
| 173 #endif // SUBZERO_SRC_ICEELFOBJECTWRITER_H | 174 #endif // SUBZERO_SRC_ICEELFOBJECTWRITER_H |
| OLD | NEW |