summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2014-01-31 05:15:42 +0000
committerRui Ueyama <ruiu@google.com>2014-01-31 05:15:42 +0000
commitebc13c47f2b7b87216adf16850ace17a28d5b18f (patch)
treeece41b5b7401eaf9f035951316152b071abd8516 /lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
parentec3da87f82c9068b8e2776c26c132fd4147bc90d (diff)
downloadbcm5719-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.cpp3
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
OpenPOWER on IntegriCloud