From: Sean Silva Date: Tue, 18 Jun 2013 01:11:21 +0000 (+0000) Subject: [yaml2obj][ELF] Ensure more fields are zero'd. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=13a8e2da7636b9f90d10cd77ac2a9194aa492cb4;p=oota-llvm.git [yaml2obj][ELF] Ensure more fields are zero'd. I was spotting garbage in the output. I'd like to just zero the entire ELFYAML::Section to be sure, but it contains non-POD types. (I'm also trying to avoid bloating the ELFYAML::Foo classes with a bunch of constructor code). No test, since this is by its very nature unpredictable. I'm pretty sure that one of the sanitizers would catch it immediately though. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184160 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/tools/yaml2obj/yaml2elf.cpp b/tools/yaml2obj/yaml2elf.cpp index bf1eec6e519..8e0383c022a 100644 --- a/tools/yaml2obj/yaml2elf.cpp +++ b/tools/yaml2obj/yaml2elf.cpp @@ -160,6 +160,8 @@ static int writeELF(raw_ostream &OS, const ELFYAML::Object &Doc) { ELFYAML::Section S; S.Type = SHT_NULL; zero(S.Flags); + zero(S.Address); + zero(S.AddressAlign); Sections.insert(Sections.begin(), S); } // "+ 1" for string table.