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

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: rebase 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
« no previous file with comments | « src/IceConverter.cpp ('k') | src/PNaClTranslator.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceELFObjectWriter.cpp
diff --git a/src/IceELFObjectWriter.cpp b/src/IceELFObjectWriter.cpp
index c428c12b6ec7c49c45dc0d85860834624826c619..2d11eb3b821c3089ab79b9e9d2bff92fcfd10f67 100644
--- a/src/IceELFObjectWriter.cpp
+++ b/src/IceELFObjectWriter.cpp
@@ -308,11 +308,13 @@ void ELFObjectWriter::writeDataSection(const VariableDeclarationList &Vars,
void ELFObjectWriter::writeDataOfType(SectionType ST,
const VariableDeclarationList &Vars,
FixupKind RelocationKind, bool IsELF64) {
+ if (Vars.empty())
+ return;
ELFDataSection *Section;
ELFRelocationSection *RelSection;
// TODO(jvoung): Handle fdata-sections.
IceString SectionName;
- Elf64_Xword ShAddralign = 0;
+ 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();
« no previous file with comments | « src/IceConverter.cpp ('k') | src/PNaClTranslator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698