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 // Abstraction for a writer that is responsible for writing an ELF file. | 10 // Abstraction for a writer that is responsible for writing an ELF file. |
11 // | 11 // |
12 //===----------------------------------------------------------------------===// | 12 //===----------------------------------------------------------------------===// |
13 | 13 |
14 #ifndef SUBZERO_SRC_ICEELFOBJECTWRITER_H | 14 #ifndef SUBZERO_SRC_ICEELFOBJECTWRITER_H |
15 #define SUBZERO_SRC_ICEELFOBJECTWRITER_H | 15 #define SUBZERO_SRC_ICEELFOBJECTWRITER_H |
16 | 16 |
17 #include "IceDefs.h" | 17 #include "IceDefs.h" |
18 #include "IceELFSection.h" | 18 #include "IceELFSection.h" |
19 #include "IceELFStreamer.h" | 19 #include "IceELFStreamer.h" |
| 20 #include "IceTypes.h" |
20 | 21 |
21 using namespace llvm::ELF; | 22 using namespace llvm::ELF; |
22 | 23 |
23 namespace Ice { | 24 namespace Ice { |
24 | 25 |
25 // Higher level ELF object writer. Manages section information and writes | 26 // Higher level ELF object writer. Manages section information and writes |
26 // the final ELF object. The object writer will write to file the code | 27 // the final ELF object. The object writer will write to file the code |
27 // and data as it is being defined (rather than keep a copy). | 28 // and data as it is being defined (rather than keep a copy). |
28 // After all definitions are written out, it will finalize the bookkeeping | 29 // After all definitions are written out, it will finalize the bookkeeping |
29 // sections and write them out. Expected usage: | 30 // sections and write them out. Expected usage: |
(...skipping 22 matching lines...) Expand all Loading... |
52 const llvm::StringRef Data); | 53 const llvm::StringRef Data); |
53 | 54 |
54 // Copy initializer data for a global to file and note the offset and | 55 // Copy initializer data for a global to file and note the offset and |
55 // size of the global's definition in the symbol table. | 56 // size of the global's definition in the symbol table. |
56 // TODO(jvoung): This needs to know which section. This also needs the | 57 // TODO(jvoung): This needs to know which section. This also needs the |
57 // relocations to hook them up to the symbol table references. Also | 58 // relocations to hook them up to the symbol table references. Also |
58 // TODO is handling BSS (which just needs to note the size). | 59 // TODO is handling BSS (which just needs to note the size). |
59 void writeDataInitializer(const IceString &VarName, | 60 void writeDataInitializer(const IceString &VarName, |
60 const llvm::StringRef Data); | 61 const llvm::StringRef Data); |
61 | 62 |
| 63 template <typename ConstType> void writeConstantPool(Type Ty); |
| 64 |
62 // Do final layout and write out the rest of the object file, then | 65 // Do final layout and write out the rest of the object file, then |
63 // patch up the initial ELF header with the final info. | 66 // patch up the initial ELF header with the final info. |
64 void writeNonUserSections(); | 67 void writeNonUserSections(); |
65 | 68 |
66 private: | 69 private: |
67 GlobalContext &Ctx; | 70 GlobalContext &Ctx; |
68 ELFStreamer &Str; | 71 ELFStreamer &Str; |
69 bool SectionNumbersAssigned; | 72 bool SectionNumbersAssigned; |
70 | 73 |
71 // All created sections, separated into different pools. | 74 // All created sections, separated into different pools. |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 | 119 |
117 // Write the ELF file header with the given information about sections. | 120 // Write the ELF file header with the given information about sections. |
118 template <bool IsELF64> | 121 template <bool IsELF64> |
119 void writeELFHeaderInternal(Elf64_Off SectionHeaderOffset, | 122 void writeELFHeaderInternal(Elf64_Off SectionHeaderOffset, |
120 SizeT SectHeaderStrIndex, SizeT NumSections); | 123 SizeT SectHeaderStrIndex, SizeT NumSections); |
121 }; | 124 }; |
122 | 125 |
123 } // end of namespace Ice | 126 } // end of namespace Ice |
124 | 127 |
125 #endif // SUBZERO_SRC_ICEELFOBJECTWRITER_H | 128 #endif // SUBZERO_SRC_ICEELFOBJECTWRITER_H |
OLD | NEW |