llvm.org GIT mirror llvm / 37c286f
[yaml2elf] - Replace a loop with write_zeros(). NFC. And apply clang-format to the method changed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359090 91177308-0d34-0410-b5e6-96231b3b80d8 George Rimar 5 months ago
1 changed file(s) with 5 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
502502 }
503503
504504 template
505 void
506 ELFState::writeSectionContent(Elf_Shdr &SHeader,
507 const ELFYAML::RawContentSection &Section,
508 ContiguousBlobAccumulator &CBA) {
505 void ELFState::writeSectionContent(
506 Elf_Shdr &SHeader, const ELFYAML::RawContentSection &Section,
507 ContiguousBlobAccumulator &CBA) {
509508 assert(Section.Size >= Section.Content.binary_size() &&
510509 "Section size and section content are inconsistent");
511510 raw_ostream &OS =
512511 CBA.getOSAndAlignedOffset(SHeader.sh_offset, SHeader.sh_addralign);
513512 Section.Content.writeAsBinary(OS);
514 for (auto i = Section.Content.binary_size(); i < Section.Size; ++i)
515 OS.write(0);
513 OS.write_zeros(Section.Size - Section.Content.binary_size());
514
516515 if (Section.EntSize)
517516 SHeader.sh_entsize = *Section.EntSize;
518517 else if (Section.Type == llvm::ELF::SHT_RELR)