| 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 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 RandomShuffle(Pool.begin(), Pool.end(), | 519 RandomShuffle(Pool.begin(), Pool.end(), |
| 520 [&RNG](uint64_t N) { return (uint32_t)RNG.next(N); }); | 520 [&RNG](uint64_t N) { return (uint32_t)RNG.next(N); }); |
| 521 } | 521 } |
| 522 // Write the data. | 522 // Write the data. |
| 523 for (Constant *C : Pool) { | 523 for (Constant *C : Pool) { |
| 524 if (!C->getShouldBePooled()) | 524 if (!C->getShouldBePooled()) |
| 525 continue; | 525 continue; |
| 526 auto Const = llvm::cast<ConstType>(C); | 526 auto Const = llvm::cast<ConstType>(C); |
| 527 std::string SymBuffer; | 527 std::string SymBuffer; |
| 528 llvm::raw_string_ostream SymStrBuf(SymBuffer); | 528 llvm::raw_string_ostream SymStrBuf(SymBuffer); |
| 529 Const->emitPoolLabel(SymStrBuf); | 529 Const->emitPoolLabel(SymStrBuf, &Ctx); |
| 530 std::string &SymName = SymStrBuf.str(); | 530 std::string &SymName = SymStrBuf.str(); |
| 531 SymTab->createDefinedSym(SymName, STT_NOTYPE, STB_LOCAL, Section, | 531 SymTab->createDefinedSym(SymName, STT_NOTYPE, STB_LOCAL, Section, |
| 532 OffsetInSection, SymbolSize); | 532 OffsetInSection, SymbolSize); |
| 533 StrTab->add(SymName); | 533 StrTab->add(SymName); |
| 534 typename ConstType::PrimType Value = Const->getValue(); | 534 typename ConstType::PrimType Value = Const->getValue(); |
| 535 memcpy(Buf, &Value, WriteAmt); | 535 memcpy(Buf, &Value, WriteAmt); |
| 536 Str.writeBytes(llvm::StringRef(Buf, WriteAmt)); | 536 Str.writeBytes(llvm::StringRef(Buf, WriteAmt)); |
| 537 OffsetInSection += WriteAmt; | 537 OffsetInSection += WriteAmt; |
| 538 } | 538 } |
| 539 Section->setSize(OffsetInSection); | 539 Section->setSize(OffsetInSection); |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 669 if (ELF64) { | 669 if (ELF64) { |
| 670 writeELFHeaderInternal<true>(ShOffset, ShStrTab->getNumber(), | 670 writeELFHeaderInternal<true>(ShOffset, ShStrTab->getNumber(), |
| 671 AllSections.size()); | 671 AllSections.size()); |
| 672 } else { | 672 } else { |
| 673 writeELFHeaderInternal<false>(ShOffset, ShStrTab->getNumber(), | 673 writeELFHeaderInternal<false>(ShOffset, ShStrTab->getNumber(), |
| 674 AllSections.size()); | 674 AllSections.size()); |
| 675 } | 675 } |
| 676 } | 676 } |
| 677 | 677 |
| 678 } // end of namespace Ice | 678 } // end of namespace Ice |
| OLD | NEW |