Chromium Code Reviews| 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(); |