summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/Mips/MCTargetDesc
diff options
context:
space:
mode:
authorDaniel Sanders <daniel.sanders@imgtec.com>2016-04-29 12:44:07 +0000
committerDaniel Sanders <daniel.sanders@imgtec.com>2016-04-29 12:44:07 +0000
commit9db710a171ef6cc2e337a81c9a8d36017d6c6eb2 (patch)
tree756bfdf00f84369c3a29c736e6a29fe6160568bc /llvm/lib/Target/Mips/MCTargetDesc
parentda29984871be1b7fade391871fe822d60222e44b (diff)
downloadbcm5719-llvm-9db710a171ef6cc2e337a81c9a8d36017d6c6eb2.tar.gz
bcm5719-llvm-9db710a171ef6cc2e337a81c9a8d36017d6c6eb2.zip
[mips][ias] Make section sizes a multiple of the alignment.
Reviewers: sdardis Subscribers: dsanders, llvm-commits, sdardis Differential Revision: http://reviews.llvm.org/D19008 llvm-svn: 268036
Diffstat (limited to 'llvm/lib/Target/Mips/MCTargetDesc')
-rw-r--r--llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp b/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp
index d4e7e58146a..9ae244bd17b 100644
--- a/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp
+++ b/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp
@@ -518,6 +518,21 @@ void MipsTargetELFStreamer::finish() {
DataSection.setAlignment(std::max(16u, DataSection.getAlignment()));
BSSSection.setAlignment(std::max(16u, BSSSection.getAlignment()));
+ // Make sections sizes a multiple of the alignment.
+ MCStreamer &OS = getStreamer();
+ for (MCSection &S : MCA) {
+ MCSectionELF &Section = static_cast<MCSectionELF &>(S);
+
+ unsigned Alignment = Section.getAlignment();
+ if (Alignment) {
+ OS.SwitchSection(&Section);
+ if (Section.UseCodeAlign())
+ OS.EmitCodeAlignment(Alignment, Alignment);
+ else
+ OS.EmitValueToAlignment(Alignment, 0, 1, Alignment);
+ }
+ }
+
const FeatureBitset &Features = STI.getFeatureBits();
// Update e_header flags. See the FIXME and comment above in
OpenPOWER on IntegriCloud