| OLD | NEW |
| 1 //===- subzero/src/IceELFSection.h - Model of ELF sections ------*- C++ -*-===// | 1 //===- subzero/src/IceELFSection.h - Model of ELF sections ------*- 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 // Representation of ELF sections. | 10 // Representation of ELF sections. |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 SizeT getNumber() const { | 59 SizeT getNumber() const { |
| 60 assert(Number != NoSectionNumber); | 60 assert(Number != NoSectionNumber); |
| 61 return Number; | 61 return Number; |
| 62 } | 62 } |
| 63 | 63 |
| 64 void setSize(Elf64_Xword sh_size) { Header.sh_size = sh_size; } | 64 void setSize(Elf64_Xword sh_size) { Header.sh_size = sh_size; } |
| 65 SizeT getCurrentSize() const { return Header.sh_size; } | 65 SizeT getCurrentSize() const { return Header.sh_size; } |
| 66 | 66 |
| 67 void setNameStrIndex(Elf64_Word sh_name) { Header.sh_name = sh_name; } | 67 void setNameStrIndex(Elf64_Word sh_name) { Header.sh_name = sh_name; } |
| 68 | 68 |
| 69 IceString getName() const { return Name; } | 69 const IceString &getName() const { return Name; } |
| 70 | 70 |
| 71 void setLinkNum(Elf64_Word sh_link) { Header.sh_link = sh_link; } | 71 void setLinkNum(Elf64_Word sh_link) { Header.sh_link = sh_link; } |
| 72 | 72 |
| 73 void setInfoNum(Elf64_Word sh_info) { Header.sh_info = sh_info; } | 73 void setInfoNum(Elf64_Word sh_info) { Header.sh_info = sh_info; } |
| 74 | 74 |
| 75 void setFileOffset(Elf64_Off sh_offset) { Header.sh_offset = sh_offset; } | 75 void setFileOffset(Elf64_Off sh_offset) { Header.sh_offset = sh_offset; } |
| 76 | 76 |
| 77 Elf64_Xword getSectionAlign() const { return Header.sh_addralign; } | 77 Elf64_Xword getSectionAlign() const { return Header.sh_addralign; } |
| 78 | 78 |
| 79 // Write the section header out with the given streamer. | 79 // Write the section header out with the given streamer. |
| 80 template <bool IsELF64> void writeHeader(ELFStreamer &Str); | 80 template <bool IsELF64> void writeHeader(ELFStreamer &Str); |
| 81 | 81 |
| 82 protected: | 82 protected: |
| 83 ~ELFSection() {} | 83 ~ELFSection() {} |
| 84 | 84 |
| 85 // Name of the section in convenient string form (instead of a index | 85 // Name of the section in convenient string form (instead of a index |
| 86 // into the Section Header String Table, which is not known till later). | 86 // into the Section Header String Table, which is not known till later). |
| 87 IceString Name; | 87 const IceString Name; |
| 88 | 88 |
| 89 // The fields of the header. May only be partially initialized, but should | 89 // The fields of the header. May only be partially initialized, but should |
| 90 // be fully initialized before writing. | 90 // be fully initialized before writing. |
| 91 Elf64_Shdr Header; | 91 Elf64_Shdr Header; |
| 92 | 92 |
| 93 // The number of the section after laying out sections. | 93 // The number of the section after laying out sections. |
| 94 SizeT Number; | 94 SizeT Number; |
| 95 }; | 95 }; |
| 96 | 96 |
| 97 // Models text/code sections. Code is written out incrementally and the | 97 // Models text/code sections. Code is written out incrementally and the |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 Rel.setSymbolAndType(Symbol->getNumber(), Fixup.kind()); | 349 Rel.setSymbolAndType(Symbol->getNumber(), Fixup.kind()); |
| 350 Str.writeAddrOrOffset<IsELF64>(Rel.r_offset); | 350 Str.writeAddrOrOffset<IsELF64>(Rel.r_offset); |
| 351 Str.writeELFWord<IsELF64>(Rel.r_info); | 351 Str.writeELFWord<IsELF64>(Rel.r_info); |
| 352 } | 352 } |
| 353 } | 353 } |
| 354 } | 354 } |
| 355 | 355 |
| 356 } // end of namespace Ice | 356 } // end of namespace Ice |
| 357 | 357 |
| 358 #endif // SUBZERO_SRC_ICEELFSECTION_H | 358 #endif // SUBZERO_SRC_ICEELFSECTION_H |
| OLD | NEW |