diff options
author | Sean Silva <chisophugis@gmail.com> | 2016-04-20 04:26:16 +0000 |
---|---|---|
committer | Sean Silva <chisophugis@gmail.com> | 2016-04-20 04:26:16 +0000 |
commit | 580c1b6952d64d807716886e3e1cc84e94a2be51 (patch) | |
tree | 5bb731e38381c246ba885269d7310f640fd0168c /lld/ELF/OutputSections.cpp | |
parent | bb3a1d92f3621f617a308731806eb95e1d763856 (diff) | |
download | bcm5719-llvm-580c1b6952d64d807716886e3e1cc84e94a2be51.tar.gz bcm5719-llvm-580c1b6952d64d807716886e3e1cc84e94a2be51.zip |
Revert "[ELF] - Avoid using memset for zero-initialization of struct member. NFC."
This reverts commit r266618. It breaks basically everything.
I think VS2013 doesn't interpret this code in the same way.
The size field (at least) is left uninitialized, causing all sorts of havok
(e.g. creating a 34GB file for a trivial hello world program).
The offending compiler reports itself as follows:
c:\release-vs2013>cl /?
Microsoft (R) C/C++ Optimizing Compiler Version 18.00.40629 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
llvm-svn: 266857
Diffstat (limited to 'lld/ELF/OutputSections.cpp')
-rw-r--r-- | lld/ELF/OutputSections.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lld/ELF/OutputSections.cpp b/lld/ELF/OutputSections.cpp index 08fed9a43ae..acbdd31cb1a 100644 --- a/lld/ELF/OutputSections.cpp +++ b/lld/ELF/OutputSections.cpp @@ -44,6 +44,7 @@ template <class ELFT> OutputSectionBase<ELFT>::OutputSectionBase(StringRef Name, uint32_t Type, uintX_t Flags) : Name(Name) { + memset(&Header, 0, sizeof(Elf_Shdr)); Header.sh_type = Type; Header.sh_flags = Flags; } |