From 65c43291817ad9b28e259919e19d340f67d8fb6d Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Tue, 17 Dec 2013 22:12:40 +0000 Subject: [PATCH] MC COFF: Emit the 'b' section flag for .bss sections in GNU assembly Without this, assembling clang's disassembly would produce an object file with the IMAGE_SCN_CNT_INITIALIZED_DATA section characteristic rather than the uninitialized one. link.exe would warn when merging comdats with different flags. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197529 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/MC/MCSectionCOFF.cpp | 2 ++ test/MC/COFF/bss_section.ll | 3 +++ 2 files changed, 5 insertions(+) diff --git a/lib/MC/MCSectionCOFF.cpp b/lib/MC/MCSectionCOFF.cpp index bb350274640..ad9ca8840f4 100644 --- a/lib/MC/MCSectionCOFF.cpp +++ b/lib/MC/MCSectionCOFF.cpp @@ -54,6 +54,8 @@ void MCSectionCOFF::PrintSwitchToSection(const MCAsmInfo &MAI, OS << "\t.section\t" << getSectionName() << ",\""; if (getKind().isText()) OS << 'x'; + else if (getKind().isBSS()) + OS << 'b'; if (getKind().isWriteable()) OS << 'w'; else diff --git a/test/MC/COFF/bss_section.ll b/test/MC/COFF/bss_section.ll index 60924f13064..477b3dfbd3a 100644 --- a/test/MC/COFF/bss_section.ll +++ b/test/MC/COFF/bss_section.ll @@ -4,3 +4,6 @@ @"\01?thingy@@3Ufoo@@B" = global %struct.foo zeroinitializer, align 4 ; CHECK: .bss + +@thingy_linkonce = linkonce_odr global %struct.foo zeroinitializer, align 4 +; CHECK: .section .bss,"bw",discard,_thingy_linkonce -- 2.34.1