Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(230)

Side by Side Diff: src/IceELFObjectWriter.h

Issue 1776473007: Subzero. Allocate global initializers from a dedicated arena. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Removes global variable (and initializer) allocation methods from GlobalContext. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/IceDefs.h ('k') | src/IceELFObjectWriter.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 /// \brief Abstraction for a writer that is responsible for writing an ELF file. 11 /// \brief Abstraction for a writer that is responsible for writing an ELF file.
12 /// 12 ///
13 //===----------------------------------------------------------------------===// 13 //===----------------------------------------------------------------------===//
14 14
15 #ifndef SUBZERO_SRC_ICEELFOBJECTWRITER_H 15 #ifndef SUBZERO_SRC_ICEELFOBJECTWRITER_H
16 #define SUBZERO_SRC_ICEELFOBJECTWRITER_H 16 #define SUBZERO_SRC_ICEELFOBJECTWRITER_H
17 17
18 #include "IceDefs.h" 18 #include "IceDefs.h"
19 #include "IceELFSection.h" 19 #include "IceELFSection.h"
20 #include "IceELFStreamer.h" 20 #include "IceELFStreamer.h"
21 #include "IceTypes.h" 21 #include "IceTypes.h"
22 22
23 using namespace llvm::ELF; 23 using namespace llvm::ELF;
24 24
25 namespace Ice { 25 namespace Ice {
26 26
27 using VariableDeclarationPartition = std::vector<VariableDeclaration *>;
28
27 /// Higher level ELF object writer. Manages section information and writes the 29 /// Higher level ELF object writer. Manages section information and writes the
28 /// final ELF object. The object writer will write to file the code and data as 30 /// final ELF object. The object writer will write to file the code and data as
29 /// it is being defined (rather than keep a copy). After all definitions are 31 /// it is being defined (rather than keep a copy). After all definitions are
30 /// written out, it will finalize the bookkeeping sections and write them out. 32 /// written out, it will finalize the bookkeeping sections and write them out.
31 /// Expected usage: 33 /// Expected usage:
32 /// 34 ///
33 /// (1) writeInitialELFHeader (invoke once) 35 /// (1) writeInitialELFHeader (invoke once)
34 /// (2) writeDataSection (may be invoked multiple times, as long as 36 /// (2) writeDataSection (may be invoked multiple times, as long as
35 /// SectionSuffix is unique) 37 /// SectionSuffix is unique)
36 /// (3) writeFunctionCode (must invoke once per function) 38 /// (3) writeFunctionCode (must invoke once per function)
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 RelSectionList &RelSections, 148 RelSectionList &RelSections,
147 SectionList &AllSections); 149 SectionList &AllSections);
148 150
149 /// Link the relocation sections to the symbol table. 151 /// Link the relocation sections to the symbol table.
150 void assignRelLinkNum(SizeT SymTabNumber, RelSectionList &RelSections); 152 void assignRelLinkNum(SizeT SymTabNumber, RelSectionList &RelSections);
151 153
152 /// Helper function for writeDataSection. Writes a data section of type 154 /// Helper function for writeDataSection. Writes a data section of type
153 /// SectionType, given the global variables Vars belonging to that 155 /// SectionType, given the global variables Vars belonging to that
154 /// SectionType. 156 /// SectionType.
155 void writeDataOfType(SectionType SectionType, 157 void writeDataOfType(SectionType SectionType,
156 const VariableDeclarationList &Vars, 158 const VariableDeclarationPartition &Vars,
157 FixupKind RelocationKind, const IceString &SectionSuffix, 159 FixupKind RelocationKind, const IceString &SectionSuffix,
158 bool IsPIC); 160 bool IsPIC);
159 161
160 /// Write the final relocation sections given the final symbol table. May also 162 /// Write the final relocation sections given the final symbol table. May also
161 /// be able to seek around the file and resolve function calls that are for 163 /// be able to seek around the file and resolve function calls that are for
162 /// functions within the same section. 164 /// functions within the same section.
163 void writeAllRelocationSections(); 165 void writeAllRelocationSections();
164 void writeRelocationSections(RelSectionList &RelSections); 166 void writeRelocationSections(RelSectionList &RelSections);
165 167
166 /// Write the ELF file header with the given information about sections. 168 /// Write the ELF file header with the given information about sections.
167 template <bool IsELF64> 169 template <bool IsELF64>
168 void writeELFHeaderInternal(Elf64_Off SectionHeaderOffset, 170 void writeELFHeaderInternal(Elf64_Off SectionHeaderOffset,
169 SizeT SectHeaderStrIndex, SizeT NumSections); 171 SizeT SectHeaderStrIndex, SizeT NumSections);
170 }; 172 };
171 173
172 } // end of namespace Ice 174 } // end of namespace Ice
173 175
174 #endif // SUBZERO_SRC_ICEELFOBJECTWRITER_H 176 #endif // SUBZERO_SRC_ICEELFOBJECTWRITER_H
OLDNEW
« no previous file with comments | « src/IceDefs.h ('k') | src/IceELFObjectWriter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698