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

Unified Diff: src/IceELFObjectWriter.cpp

Issue 899483002: Subzero: Track protos + globals w/out initializers as undef too (not just helper funcs) (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: x 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/IceELFObjectWriter.cpp
diff --git a/src/IceELFObjectWriter.cpp b/src/IceELFObjectWriter.cpp
index c428c12b6ec7c49c45dc0d85860834624826c619..b7ece6977f235504ff77876f4c8b338ddcb7b04a 100644
--- a/src/IceELFObjectWriter.cpp
+++ b/src/IceELFObjectWriter.cpp
@@ -312,7 +312,9 @@ void ELFObjectWriter::writeDataOfType(SectionType ST,
ELFRelocationSection *RelSection;
// TODO(jvoung): Handle fdata-sections.
IceString SectionName;
- Elf64_Xword ShAddralign = 0;
+ if (Vars.empty())
Jim Stichnoth 2015/02/02 21:57:26 Move this to the top? or at least above the IceSt
jvoung (off chromium) 2015/02/03 01:53:38 Done.
+ return;
+ Elf64_Xword ShAddralign = 1;
for (VariableDeclaration *Var : Vars) {
Elf64_Xword Align = Var->getAlignment();
ShAddralign = std::max(ShAddralign, Align);
@@ -362,6 +364,10 @@ void ELFObjectWriter::writeDataOfType(SectionType ST,
const uint8_t SymbolType = STT_OBJECT;
for (VariableDeclaration *Var : Vars) {
+ // If the variable declaration does not have an initializer, its symtab
+ // entry will be created separately.
+ if (!Var->hasInitializer())
+ continue;
Elf64_Xword Align = Var->getAlignment();
Section->padToAlignment(Str, Align);
SizeT SymbolSize = Var->getNumBytes();
« src/IceConverter.cpp ('K') | « src/IceConverter.cpp ('k') | src/PNaClTranslator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698