[llvm] r197529 - MC COFF: Emit the 'b' section flag for .bss sections in GNU assembly
Reid Kleckner
reid at kleckner.net
Tue Dec 17 14:12:41 PST 2013
Author: rnk
Date: Tue Dec 17 16:12:40 2013
New Revision: 197529
URL: http://llvm.org/viewvc/llvm-project?rev=197529&view=rev
Log:
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.
Modified:
llvm/trunk/lib/MC/MCSectionCOFF.cpp
llvm/trunk/test/MC/COFF/bss_section.ll
Modified: llvm/trunk/lib/MC/MCSectionCOFF.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCSectionCOFF.cpp?rev=197529&r1=197528&r2=197529&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCSectionCOFF.cpp (original)
+++ llvm/trunk/lib/MC/MCSectionCOFF.cpp Tue Dec 17 16:12:40 2013
@@ -54,6 +54,8 @@ void MCSectionCOFF::PrintSwitchToSection
OS << "\t.section\t" << getSectionName() << ",\"";
if (getKind().isText())
OS << 'x';
+ else if (getKind().isBSS())
+ OS << 'b';
if (getKind().isWriteable())
OS << 'w';
else
Modified: llvm/trunk/test/MC/COFF/bss_section.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/COFF/bss_section.ll?rev=197529&r1=197528&r2=197529&view=diff
==============================================================================
--- llvm/trunk/test/MC/COFF/bss_section.ll (original)
+++ llvm/trunk/test/MC/COFF/bss_section.ll Tue Dec 17 16:12:40 2013
@@ -4,3 +4,6 @@
@"\01?thingy@@3Ufoo@@B" = global %struct.foo zeroinitializer, align 4
; CHECK: .bss
+
+ at thingy_linkonce = linkonce_odr global %struct.foo zeroinitializer, align 4
+; CHECK: .section .bss,"bw",discard,_thingy_linkonce
More information about the llvm-commits
mailing list