summaryrefslogtreecommitdiff
path: root/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp')
-rw-r--r--llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp b/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp
index caae5890fae1..9893c6055f81 100644
--- a/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp
+++ b/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp
@@ -899,9 +899,9 @@ void MipsTargetELFStreamer::finish() {
MCSection &BSSSection = *OFI.getBSSSection();
MCA.registerSection(BSSSection);
- TextSection.setAlignment(Align(std::max(16u, TextSection.getAlignment())));
- DataSection.setAlignment(Align(std::max(16u, DataSection.getAlignment())));
- BSSSection.setAlignment(Align(std::max(16u, BSSSection.getAlignment())));
+ TextSection.ensureMinAlignment(Align(16));
+ DataSection.ensureMinAlignment(Align(16));
+ BSSSection.ensureMinAlignment(Align(16));
if (RoundSectionSizes) {
// Make sections sizes a multiple of the alignment. This is useful for
@@ -912,14 +912,12 @@ void MipsTargetELFStreamer::finish() {
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, &STI, Alignment);
- else
- OS.emitValueToAlignment(Alignment, 0, 1, Alignment);
- }
+ Align Alignment = Section.getAlign();
+ OS.switchSection(&Section);
+ if (Section.useCodeAlign())
+ OS.emitCodeAlignment(Alignment, &STI, Alignment.value());
+ else
+ OS.emitValueToAlignment(Alignment, 0, 1, Alignment.value());
}
}