| 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 // This file defines the writer for ELF relocatable object files. | 10 // This file defines the writer for ELF relocatable object files. |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 assert(ST == BSS || ST == ROData); | 376 assert(ST == BSS || ST == ROData); |
| 377 if (ST == ROData) | 377 if (ST == ROData) |
| 378 Section->appendZeros(Str, SymbolSize); | 378 Section->appendZeros(Str, SymbolSize); |
| 379 else | 379 else |
| 380 Section->setSize(Section->getCurrentSize() + SymbolSize); | 380 Section->setSize(Section->getCurrentSize() + SymbolSize); |
| 381 } else { | 381 } else { |
| 382 assert(ST != BSS); | 382 assert(ST != BSS); |
| 383 for (VariableDeclaration::Initializer *Init : Var->getInitializers()) { | 383 for (VariableDeclaration::Initializer *Init : Var->getInitializers()) { |
| 384 switch (Init->getKind()) { | 384 switch (Init->getKind()) { |
| 385 case VariableDeclaration::Initializer::DataInitializerKind: { | 385 case VariableDeclaration::Initializer::DataInitializerKind: { |
| 386 const auto Data = llvm::cast<VariableDeclaration::DataInitializer>( | 386 const auto Data = |
| 387 Init)->getContents(); | 387 llvm::cast<VariableDeclaration::DataInitializer>(Init) |
| 388 ->getContents(); |
| 388 Section->appendData(Str, llvm::StringRef(Data.data(), Data.size())); | 389 Section->appendData(Str, llvm::StringRef(Data.data(), Data.size())); |
| 389 break; | 390 break; |
| 390 } | 391 } |
| 391 case VariableDeclaration::Initializer::ZeroInitializerKind: | 392 case VariableDeclaration::Initializer::ZeroInitializerKind: |
| 392 Section->appendZeros(Str, Init->getNumBytes()); | 393 Section->appendZeros(Str, Init->getNumBytes()); |
| 393 break; | 394 break; |
| 394 case VariableDeclaration::Initializer::RelocInitializerKind: { | 395 case VariableDeclaration::Initializer::RelocInitializerKind: { |
| 395 const auto Reloc = | 396 const auto Reloc = |
| 396 llvm::cast<VariableDeclaration::RelocInitializer>(Init); | 397 llvm::cast<VariableDeclaration::RelocInitializer>(Init); |
| 397 AssemblerFixup NewFixup; | 398 AssemblerFixup NewFixup; |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 if (ELF64) { | 608 if (ELF64) { |
| 608 writeELFHeaderInternal<true>(ShOffset, ShStrTab->getNumber(), | 609 writeELFHeaderInternal<true>(ShOffset, ShStrTab->getNumber(), |
| 609 AllSections.size()); | 610 AllSections.size()); |
| 610 } else { | 611 } else { |
| 611 writeELFHeaderInternal<false>(ShOffset, ShStrTab->getNumber(), | 612 writeELFHeaderInternal<false>(ShOffset, ShStrTab->getNumber(), |
| 612 AllSections.size()); | 613 AllSections.size()); |
| 613 } | 614 } |
| 614 } | 615 } |
| 615 | 616 |
| 616 } // end of namespace Ice | 617 } // end of namespace Ice |
| OLD | NEW |