[lld] r187505 - [PECOFF] Add a comment about .bss section.
Rui Ueyama
ruiu at google.com
Wed Jul 31 10:45:48 PDT 2013
Author: ruiu
Date: Wed Jul 31 12:45:48 2013
New Revision: 187505
URL: http://llvm.org/viewvc/llvm-project?rev=187505&view=rev
Log:
[PECOFF] Add a comment about .bss section.
Modified:
lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
Modified: lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp?rev=187505&r1=187504&r2=187505&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp Wed Jul 31 12:45:48 2013
@@ -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.
More information about the llvm-commits
mailing list