diff options
author | Rui Ueyama <ruiu@google.com> | 2014-01-31 05:15:42 +0000 |
---|---|---|
committer | Rui Ueyama <ruiu@google.com> | 2014-01-31 05:15:42 +0000 |
commit | ebc13c47f2b7b87216adf16850ace17a28d5b18f (patch) | |
tree | ece41b5b7401eaf9f035951316152b071abd8516 /lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp | |
parent | ec3da87f82c9068b8e2776c26c132fd4147bc90d (diff) | |
download | bcm5719-llvm-ebc13c47f2b7b87216adf16850ace17a28d5b18f.tar.gz bcm5719-llvm-ebc13c47f2b7b87216adf16850ace17a28d5b18f.zip |
[PECOFF] Do not emit a section if it's empty.
The PE32+ loader does not seem to like an executable with an empty section, so
we should not emit a section if it's empty.
llvm-svn: 200514
Diffstat (limited to 'lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp')
-rw-r--r-- | lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp b/lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp index ebdc246217f..71daf5ad27e 100644 --- a/lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp +++ b/lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp @@ -932,7 +932,8 @@ void PECOFFWriter::build(const File &linkedFile) { StringRef sectionName = i.first; std::vector<const DefinedAtom *> &contents = i.second; auto *section = new AtomChunk(_ctx, sectionName, contents); - addSectionChunk(section, sectionTable); + if (section->size() > 0) + addSectionChunk(section, sectionTable); } // Now that we know the addresses of all defined atoms that needs to be |