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

Unified Diff: src/IceTargetLoweringX8632.cpp

Issue 874353006: Write out global initializers and data rel directly to ELF file. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: pull statics out Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: src/IceTargetLoweringX8632.cpp
diff --git a/src/IceTargetLoweringX8632.cpp b/src/IceTargetLoweringX8632.cpp
index b092f7ffaa443534d69621800a6e325b5546a7a2..9bc8f8a5903813d3d5d92cef07561a913e83b13e 100644
--- a/src/IceTargetLoweringX8632.cpp
+++ b/src/IceTargetLoweringX8632.cpp
@@ -4634,20 +4634,13 @@ TargetGlobalInitX8632::TargetGlobalInitX8632(GlobalContext *Ctx)
: TargetGlobalInitLowering(Ctx) {}
void TargetGlobalInitX8632::lower(const VariableDeclaration &Var) {
- // TODO(jvoung): handle this without text.
- if (Ctx->getFlags().UseELFWriter)
- return;
-
- Ostream &Str = Ctx->getStrEmit();
-
- const VariableDeclaration::InitializerListType &Initializers =
- Var.getInitializers();
-
// If external and not initialized, this must be a cross test.
// Don't generate a declaration for such cases.
bool IsExternal = Var.isExternal() || Ctx->getFlags().DisableInternal;
if (IsExternal && !Var.hasInitializer()) return;
+ const VariableDeclaration::InitializerListType &Initializers =
+ Var.getInitializers();
bool HasNonzeroInitializer = Var.hasNonzeroInitializer();
bool IsConstant = Var.getIsConstant();
uint32_t Align = Var.getAlignment();
@@ -4657,6 +4650,8 @@ void TargetGlobalInitX8632::lower(const VariableDeclaration &Var) {
if (Ctx->getFlags().DataSections)
SectionSuffix = "." + MangledName;
+ Ostream &Str = Ctx->getStrEmit();
+
Str << "\t.type\t" << MangledName << ",@object\n";
if (IsConstant)
@@ -4714,4 +4709,10 @@ void TargetGlobalInitX8632::lower(const VariableDeclaration &Var) {
Str << "\t.size\t" << MangledName << ", " << Size << "\n";
}
+void TargetGlobalInitX8632::lowerGlobalsELF(
+ const VariableDeclarationList &Vars) {
+ ELFObjectWriter *Writer = Ctx->getObjectWriter();
+ Writer->writeDataSection(Vars, llvm::ELF::R_386_32);
+}
+
} // end of namespace Ice
« src/IceGlobalInits.h ('K') | « src/IceTargetLoweringX8632.h ('k') | src/IceTimerTree.def » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698