diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2013-11-25 16:06:04 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2013-11-25 16:06:04 +0000 |
commit | edcf1ff7d1855d29a8befa335d79e5d0a61523d6 (patch) | |
tree | d973a1658ae4a0c529a006477877d84783e588a4 /llvm/lib | |
parent | 3294e05762d478451e76ad566301b275ec4307cb (diff) | |
download | bcm5719-llvm-edcf1ff7d1855d29a8befa335d79e5d0a61523d6.tar.gz bcm5719-llvm-edcf1ff7d1855d29a8befa335d79e5d0a61523d6.zip |
Fix .comm and .lcomm on COFF.
These should not use COMDATs. GNU as uses .bss for .lcomm and section 0 for
.comm.
Given
static int a;
int b;
MSVC puts both in .bss. This patch then puts both .comm and .lcomm on .bss. With
this change we agree with gas on .lcomm, are much closer on .comm and clang-cl
matches msvc on the above example.
llvm-svn: 195654
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/MC/WinCOFFStreamer.cpp | 20 |
1 files changed, 2 insertions, 18 deletions
diff --git a/llvm/lib/MC/WinCOFFStreamer.cpp b/llvm/lib/MC/WinCOFFStreamer.cpp index 0c205e50709..af313b2ff88 100644 --- a/llvm/lib/MC/WinCOFFStreamer.cpp +++ b/llvm/lib/MC/WinCOFFStreamer.cpp @@ -140,28 +140,12 @@ void WinCOFFStreamer::AddCommonSymbol(MCSymbol *Symbol, uint64_t Size, unsigned ByteAlignment, bool External) { assert(!Symbol->isInSection() && "Symbol must not already have a section!"); - std::string SectionName(".bss$linkonce"); - SectionName.append(Symbol->getName().begin(), Symbol->getName().end()); - - MCSymbolData &SymbolData = getAssembler().getOrCreateSymbolData(*Symbol); - - unsigned Characteristics = - COFF::IMAGE_SCN_LNK_COMDAT | - COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA | - COFF::IMAGE_SCN_MEM_READ | - COFF::IMAGE_SCN_MEM_WRITE; - - int Selection = COFF::IMAGE_COMDAT_SELECT_LARGEST; - - const MCSection *Section = MCStreamer::getContext().getCOFFSection( - SectionName, Characteristics, SectionKind::getBSS(), Symbol->getName(), - Selection); - + const MCSectionCOFF *Section = getSectionBSS(); MCSectionData &SectionData = getAssembler().getOrCreateSectionData(*Section); - if (SectionData.getAlignment() < ByteAlignment) SectionData.setAlignment(ByteAlignment); + MCSymbolData &SymbolData = getAssembler().getOrCreateSymbolData(*Symbol); SymbolData.setExternal(External); AssignSection(Symbol, Section); |