From 3361fa49f5b110a36cf10be3800e15566c53bf19 Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Wed, 31 Jul 2013 17:45:48 +0000 Subject: [PATCH] [PECOFF] Add a comment about .bss section. llvm-svn: 187505 --- lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp b/lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp index 64a1f6c0b229..d7d81767f19b 100644 --- a/lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp +++ b/lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp @@ -579,6 +579,15 @@ private: }; // \brief A BSSSectionChunk represents a .bss section. +// +// Seems link.exe does not emit .bss section but instead merges it with .data +// section. In COFF, if the size of the section in the header is greater than +// the size of the actual data on disk, the section on memory is zero-padded. +// That's why .bss can be merge with .data just by appending it at the end of +// the section. +// +// The executable with .bss is also valid and easier to understand. So we chose +// to create .bss in LLD. class BssSectionChunk : public SectionChunk { public: // BSS section does not have contents, so write should be no-op.