summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCAssembler.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-03-08 22:03:42 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-03-08 22:03:42 +0000
commit3a3f472cb457eab29563ff4afd3ae61511eed71a (patch)
tree9fb4a75016bb914decc56166a31804f5685c766a /llvm/lib/MC/MCAssembler.cpp
parent8119fe87d8a04810c848a94cdc8b9523d17538fd (diff)
downloadbcm5719-llvm-3a3f472cb457eab29563ff4afd3ae61511eed71a.tar.gz
bcm5719-llvm-3a3f472cb457eab29563ff4afd3ae61511eed71a.zip
MC/Macho-O: Align the zerofill section itself to the maximum alignment.
llvm-svn: 97991
Diffstat (limited to 'llvm/lib/MC/MCAssembler.cpp')
-rw-r--r--llvm/lib/MC/MCAssembler.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/MC/MCAssembler.cpp b/llvm/lib/MC/MCAssembler.cpp
index 1ec1d815de4..4b78dc034fc 100644
--- a/llvm/lib/MC/MCAssembler.cpp
+++ b/llvm/lib/MC/MCAssembler.cpp
@@ -1279,9 +1279,19 @@ void MCAssembler::Finish() {
if (!isVirtualSection(SD.getSection()))
continue;
+ // Align this section if necessary by adding padding bytes to the previous
+ // section.
+ if (uint64_t Pad = OffsetToAlignment(Address, it->getAlignment())) {
+ assert(Prev && "Missing prev section!");
+ Prev->setFileSize(Prev->getFileSize() + Pad);
+ Address += Pad;
+ }
+
SD.setAddress(Address);
LayoutSection(SD);
Address += SD.getSize();
+
+ Prev = &SD;
}
DEBUG_WITH_TYPE("mc-dump", {
OpenPOWER on IntegriCloud