ELF2: Use memcpy to vector contents.

llvm-svn: 249959
This commit is contained in:
Rui Ueyama 2015-10-11 00:10:36 +00:00
parent 953c2c4b2d
commit bdca0b1fac
1 changed files with 1 additions and 4 deletions

View File

@ -591,10 +591,7 @@ template <class ELFT> void Writer<ELFT>::writeHeader() {
EHdr->e_shentsize = sizeof(Elf_Shdr);
EHdr->e_shnum = getNumSections();
EHdr->e_shstrndx = Out<ELFT>::StrTab->getSectionIndex();
auto PHdrs = reinterpret_cast<Elf_Phdr *>(Buf + EHdr->e_phoff);
for (Elf_Phdr &PH : Phdrs)
*PHdrs++ = PH;
memcpy(Buf + EHdr->e_phoff, &Phdrs[0], Phdrs.size() * sizeof(Phdrs[0]));
auto SHdrs = reinterpret_cast<Elf_Shdr *>(Buf + EHdr->e_shoff);
// First entry is null.