| OLD | NEW |
| 1 //===- subzero/src/IceELFObjectWriter.cpp - ELF object file writer --------===// | 1 //===- subzero/src/IceELFObjectWriter.cpp - ELF object file writer --------===// |
| 2 // | 2 // |
| 3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
| 4 // | 4 // |
| 5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
| 6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
| 7 // | 7 // |
| 8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
| 9 /// | 9 /// |
| 10 /// \file | 10 /// \file |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 llvm::report_fatal_error("Unknown SectionType"); | 381 llvm::report_fatal_error("Unknown SectionType"); |
| 382 break; | 382 break; |
| 383 } | 383 } |
| 384 | 384 |
| 385 constexpr uint8_t SymbolType = STT_OBJECT; | 385 constexpr uint8_t SymbolType = STT_OBJECT; |
| 386 for (VariableDeclaration *Var : Vars) { | 386 for (VariableDeclaration *Var : Vars) { |
| 387 // If the variable declaration does not have an initializer, its symtab | 387 // If the variable declaration does not have an initializer, its symtab |
| 388 // entry will be created separately. | 388 // entry will be created separately. |
| 389 if (!Var->hasInitializer()) | 389 if (!Var->hasInitializer()) |
| 390 continue; | 390 continue; |
| 391 Elf64_Xword Align = Var->getAlignment(); | |
| 392 constexpr Elf64_Xword MinAlign = 1; | 391 constexpr Elf64_Xword MinAlign = 1; |
| 393 Align = std::max(Align, MinAlign); | 392 const auto Align = std::max<Elf64_Xword>(MinAlign, Var->getAlignment()); |
| 394 Section->padToAlignment(Str, Align); | 393 Section->padToAlignment(Str, Align); |
| 395 SizeT SymbolSize = Var->getNumBytes(); | 394 SizeT SymbolSize = Var->getNumBytes(); |
| 396 bool IsExternal = Var->isExternal() || Ctx.getFlags().getDisableInternal(); | 395 bool IsExternal = Var->isExternal() || Ctx.getFlags().getDisableInternal(); |
| 397 const uint8_t SymbolBinding = IsExternal ? STB_GLOBAL : STB_LOCAL; | 396 const uint8_t SymbolBinding = IsExternal ? STB_GLOBAL : STB_LOCAL; |
| 398 const IceString &Name = Var->getName(); | 397 const IceString &Name = Var->getName(); |
| 399 SymTab->createDefinedSym(Name, SymbolType, SymbolBinding, Section, | 398 SymTab->createDefinedSym(Name, SymbolType, SymbolBinding, Section, |
| 400 Section->getCurrentSize(), SymbolSize); | 399 Section->getCurrentSize(), SymbolSize); |
| 401 StrTab->add(Name); | 400 StrTab->add(Name); |
| 402 if (!Var->hasNonzeroInitializer()) { | 401 if (!Var->hasNonzeroInitializer()) { |
| 403 assert(ST == BSS || ST == ROData); | 402 assert(ST == BSS || ST == ROData); |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 if (ELF64) { | 691 if (ELF64) { |
| 693 writeELFHeaderInternal<true>(ShOffset, ShStrTab->getNumber(), | 692 writeELFHeaderInternal<true>(ShOffset, ShStrTab->getNumber(), |
| 694 AllSections.size()); | 693 AllSections.size()); |
| 695 } else { | 694 } else { |
| 696 writeELFHeaderInternal<false>(ShOffset, ShStrTab->getNumber(), | 695 writeELFHeaderInternal<false>(ShOffset, ShStrTab->getNumber(), |
| 697 AllSections.size()); | 696 AllSections.size()); |
| 698 } | 697 } |
| 699 } | 698 } |
| 700 | 699 |
| 701 } // end of namespace Ice | 700 } // end of namespace Ice |
| OLD | NEW |