diff options
Diffstat (limited to 'lib/Target/Hexagon/MCTargetDesc/HexagonMCELFStreamer.cpp')
-rw-r--r-- | lib/Target/Hexagon/MCTargetDesc/HexagonMCELFStreamer.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/lib/Target/Hexagon/MCTargetDesc/HexagonMCELFStreamer.cpp b/lib/Target/Hexagon/MCTargetDesc/HexagonMCELFStreamer.cpp index eaa3550d07f6..67dcb8fea739 100644 --- a/lib/Target/Hexagon/MCTargetDesc/HexagonMCELFStreamer.cpp +++ b/lib/Target/Hexagon/MCTargetDesc/HexagonMCELFStreamer.cpp @@ -107,15 +107,20 @@ void HexagonMCELFStreamer::HexagonMCEmitCommonSymbol(MCSymbol *Symbol, ((AccessSize == 0) || (Size == 0) || (Size > GPSize)) ? ".bss" : sbss[(Log2_64(AccessSize))]; - - MCSection *CrntSection = getCurrentSection().first; - MCSection *Section = getAssembler().getContext().getELFSection( + MCSection &Section = *getAssembler().getContext().getELFSection( SectionName, ELF::SHT_NOBITS, ELF::SHF_WRITE | ELF::SHF_ALLOC); - SwitchSection(Section); - AssignFragment(Symbol, getCurrentFragment()); + MCSectionSubPair P = getCurrentSection(); + SwitchSection(&Section); + + EmitValueToAlignment(ByteAlignment, 0, 1, 0); + EmitLabel(Symbol); + EmitZeros(Size); + + // Update the maximum alignment of the section if necessary. + if (ByteAlignment > Section.getAlignment()) + Section.setAlignment(ByteAlignment); - MCELFStreamer::EmitCommonSymbol(Symbol, Size, ByteAlignment); - SwitchSection(CrntSection); + SwitchSection(P.first, P.second); } else { if (ELFSymbol->declareCommon(Size, ByteAlignment)) report_fatal_error("Symbol: " + Symbol->getName() + |