summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2013-06-28 20:10:36 +0000
committerRui Ueyama <ruiu@google.com>2013-06-28 20:10:36 +0000
commite9dd5f98cf80ed2e6edc213da3226283e7ba7ad5 (patch)
tree26b3fb51e265ecb83f9003362adfccf6aeb08eb0 /lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
parentf2694970680c9fce4b5876df39964f4d1f2d324f (diff)
downloadbcm5719-llvm-e9dd5f98cf80ed2e6edc213da3226283e7ba7ad5.tar.gz
bcm5719-llvm-e9dd5f98cf80ed2e6edc213da3226283e7ba7ad5.zip
[PECOFF][Writer] Fix wrong section header.
llvm-svn: 185205
Diffstat (limited to 'lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp')
-rw-r--r--lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp b/lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
index 94c9078a689..be5f5bb1377 100644
--- a/lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
+++ b/lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
@@ -274,9 +274,10 @@ private:
/// written to the raw data section.
class SectionChunk : public Chunk {
public:
+ /// Returns the size of the section on disk. The returned value is multiple
+ /// of disk sector, so the size may include the null padding at the end of
+ /// section.
virtual uint64_t size() const {
- // Round up to the nearest alignment border, so that the text segment ends
- // at a border.
return llvm::RoundUpToAlignment(_size, _align);
}
@@ -379,9 +380,11 @@ protected:
}
// Now that we have a list of atoms that to be written in this section,
- // and we know the size of the section.
+ // and we know the size of the section. Let's write them to the section
+ // header. VirtualSize should be the size of the actual content, and
+ // SizeOfRawData should be aligned to the section alignment.
_sectionHeader.VirtualSize = _size;
- _sectionHeader.SizeOfRawData = _size;
+ _sectionHeader.SizeOfRawData = size();
}
private:
OpenPOWER on IntegriCloud