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

Unified Diff: src/IceTargetLoweringX8632.cpp

Issue 667763002: Fix handling of relocation names, so that prefix mangling works. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix nits. Created 6 years, 2 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
« no previous file with comments | « src/IceOperand.cpp ('k') | src/IceTranslator.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceTargetLoweringX8632.cpp
diff --git a/src/IceTargetLoweringX8632.cpp b/src/IceTargetLoweringX8632.cpp
index 0319768937c833235b00c747f731198ee5dfd4df..98b18dc1c3ee559193b313c404c70d27cd5a944f 100644
--- a/src/IceTargetLoweringX8632.cpp
+++ b/src/IceTargetLoweringX8632.cpp
@@ -4448,10 +4448,14 @@ void TargetGlobalInitX8632::lower(const VariableDeclaration &Var) {
const VariableDeclaration::InitializerListType &Initializers =
Var.getInitializers();
- assert(Initializers.size());
- bool HasInitializer = Var.hasInitializer();
+
+ // If external and not initialized, this must be a cross test.
+ // Don't generate a declaration for such cases.
+ bool IsExternal = Var.isExternal();
+ if (IsExternal && !Var.hasInitializer()) return;
+
+ bool HasNonzeroInitializer = Var.hasNonzeroInitializer();
bool IsConstant = Var.getIsConstant();
- bool IsExternal = Var.getIsExternal();
uint32_t Align = Var.getAlignment();
SizeT Size = Var.getNumBytes();
IceString MangledName = Var.mangleName(Ctx);
@@ -4463,7 +4467,7 @@ void TargetGlobalInitX8632::lower(const VariableDeclaration &Var) {
if (IsConstant)
Str << "\t.section\t.rodata" << SectionSuffix << ",\"a\",@progbits\n";
- else if (HasInitializer)
+ else if (HasNonzeroInitializer)
Str << "\t.section\t.data" << SectionSuffix << ",\"aw\",@progbits\n";
else if (IsExternal)
Str << "\t.section\t.bss" << SectionSuffix << ",\"aw\",@nobits\n";
@@ -4471,20 +4475,20 @@ void TargetGlobalInitX8632::lower(const VariableDeclaration &Var) {
if (IsExternal)
Str << "\t.globl\t" << MangledName << "\n";
- else if (!IsConstant && !HasInitializer)
+ else if (!IsConstant && !HasNonzeroInitializer)
Str << "\t.local\t" << MangledName << "\n";
// Internal symbols only get .local when using .comm.
- if ((IsConstant || HasInitializer || IsExternal) && Align > 1)
+ if ((IsConstant || HasNonzeroInitializer || IsExternal) && Align > 1)
Str << "\t.align\t" << Align << "\n";
// Alignment is part of .comm.
- if (IsConstant || HasInitializer || IsExternal)
+ if (IsConstant || HasNonzeroInitializer || IsExternal)
Str << MangledName << ":\n";
else
Str << "\t.comm\t" << MangledName << "," << Size << "," << Align << "\n";
- if (HasInitializer) {
+ if (HasNonzeroInitializer) {
for (VariableDeclaration::Initializer *Init : Initializers) {
switch (Init->getKind()) {
case VariableDeclaration::Initializer::DataInitializerKind: {
@@ -4526,7 +4530,7 @@ void TargetGlobalInitX8632::lower(const VariableDeclaration &Var) {
Str << "\t.zero\t" << Size << "\n";
// Size is part of .comm.
- if (IsConstant || HasInitializer || IsExternal)
+ if (IsConstant || HasNonzeroInitializer || IsExternal)
Str << "\t.size\t" << MangledName << ", " << Size << "\n";
// Size is part of .comm.
}
« no previous file with comments | « src/IceOperand.cpp ('k') | src/IceTranslator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698