[PATCH] D44986: Initialize Elf header and Program Header to Zero
Rumeet Dhindsa via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 28 10:23:43 PDT 2018
rdhindsa created this revision.
rdhindsa added a reviewer: ruiu.
Herald added subscribers: llvm-commits, arichardson, emaste.
Initialize Elf header and Program Header to Zero to ensure that bytes not assigned any value later on are initialized properly.
Repository:
rLLD LLVM Linker
https://reviews.llvm.org/D44986
Files:
lld/ELF/Writer.cpp
Index: lld/ELF/Writer.cpp
===================================================================
--- lld/ELF/Writer.cpp
+++ lld/ELF/Writer.cpp
@@ -2108,6 +2108,7 @@
template <class ELFT> void Writer<ELFT>::writeHeader() {
uint8_t *Buf = Buffer->getBufferStart();
+ memset(Buf, 0 , sizeof(Elf_Ehdr)+sizeof(Elf_Phdr));
memcpy(Buf, "\177ELF", 4);
// Write the ELF header.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44986.140098.patch
Type: text/x-patch
Size: 381 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180328/03bf58e0/attachment.bin>
More information about the llvm-commits
mailing list