[llvm] r207028 - MC: honour IMAGE_SCN_CNT_INITIALIZED_DATA

Saleem Abdulrasool compnerd at compnerd.org
Wed Apr 23 14:29:35 PDT 2014


Author: compnerd
Date: Wed Apr 23 16:29:34 2014
New Revision: 207028

URL: http://llvm.org/viewvc/llvm-project?rev=207028&view=rev
Log:
MC: honour IMAGE_SCN_CNT_INITIALIZED_DATA

Emit the flag to indicate to the assembler that a section contains data if there
is pre-populated data present.

Added:
    llvm/trunk/test/CodeGen/Generic/initialised-data.ll
Modified:
    llvm/trunk/lib/MC/MCSectionCOFF.cpp
    llvm/trunk/test/CodeGen/X86/dllexport-x86_64.ll
    llvm/trunk/test/CodeGen/X86/dllexport.ll
    llvm/trunk/test/CodeGen/X86/global-sections.ll
    llvm/trunk/test/DebugInfo/COFF/asm.ll
    llvm/trunk/test/DebugInfo/COFF/multifile.ll
    llvm/trunk/test/DebugInfo/COFF/multifunction.ll
    llvm/trunk/test/DebugInfo/COFF/simple.ll
    llvm/trunk/test/DebugInfo/COFF/tail-call-without-lexical-scopes.ll
    llvm/trunk/test/DebugInfo/X86/coff_debug_info_type.ll
    llvm/trunk/test/MC/COFF/global_ctors_dtors.ll
    llvm/trunk/test/MC/COFF/weak-symbol.ll

Modified: llvm/trunk/lib/MC/MCSectionCOFF.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCSectionCOFF.cpp?rev=207028&r1=207027&r2=207028&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCSectionCOFF.cpp (original)
+++ llvm/trunk/lib/MC/MCSectionCOFF.cpp Wed Apr 23 16:29:34 2014
@@ -62,7 +62,8 @@ void MCSectionCOFF::PrintSwitchToSection
     OS << 'r';
   if (getCharacteristics() & COFF::IMAGE_SCN_MEM_DISCARDABLE)
     OS << 'n';
-
+  if (getCharacteristics() & COFF::IMAGE_SCN_CNT_INITIALIZED_DATA)
+    OS << 'd';
   OS << '"';
 
   if (getCharacteristics() & COFF::IMAGE_SCN_LNK_COMDAT) {

Added: llvm/trunk/test/CodeGen/Generic/initialised-data.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Generic/initialised-data.ll?rev=207028&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/Generic/initialised-data.ll (added)
+++ llvm/trunk/test/CodeGen/Generic/initialised-data.ll Wed Apr 23 16:29:34 2014
@@ -0,0 +1,8 @@
+; RUN: llc -mtriple i686-windows %s -o - | FileCheck %s
+; RUN: llc -mtriple x86_64-windows %s -o - | FileCheck %s
+; RUN: llc -mtriple thumbv7-windows %s -o - | FileCheck %s
+
+ at data = dllexport constant [5 x i8] c"data\00", align 1
+
+; CHECK: .section	.rdata,"rd"
+

Modified: llvm/trunk/test/CodeGen/X86/dllexport-x86_64.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/dllexport-x86_64.ll?rev=207028&r1=207027&r2=207028&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/dllexport-x86_64.ll (original)
+++ llvm/trunk/test/CodeGen/X86/dllexport-x86_64.ll Wed Apr 23 16:29:34 2014
@@ -40,18 +40,18 @@ define weak_odr dllexport void @weak1()
 ; CHECK: .globl Var1
 @Var1 = dllexport global i32 1, align 4
 
-; CHECK: .rdata,"r"
+; CHECK: .rdata,"rd"
 ; CHECK: .globl Var2
 @Var2 = dllexport unnamed_addr constant i32 1
 
 ; CHECK: .comm Var3
 @Var3 = common dllexport global i32 0, align 4
 
-; CHECK: .section .data,"w",discard,WeakVar1
+; CHECK: .section .data,"wd",discard,WeakVar1
 ; CHECK: .globl WeakVar1
 @WeakVar1 = weak_odr dllexport global i32 1, align 4
 
-; CHECK: .section .rdata,"r",discard,WeakVar2
+; CHECK: .section .rdata,"rd",discard,WeakVar2
 ; CHECK: .globl WeakVar2
 @WeakVar2 = weak_odr dllexport unnamed_addr constant i32 1
 

Modified: llvm/trunk/test/CodeGen/X86/dllexport.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/dllexport.ll?rev=207028&r1=207027&r2=207028&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/dllexport.ll (original)
+++ llvm/trunk/test/CodeGen/X86/dllexport.ll Wed Apr 23 16:29:34 2014
@@ -55,18 +55,18 @@ define weak_odr dllexport void @weak1()
 ; CHECK: .globl _Var1
 @Var1 = dllexport global i32 1, align 4
 
-; CHECK: .rdata,"r"
+; CHECK: .rdata,"rd"
 ; CHECK: .globl _Var2
 @Var2 = dllexport unnamed_addr constant i32 1
 
 ; CHECK: .comm _Var3
 @Var3 = common dllexport global i32 0, align 4
 
-; CHECK: .section .data,"w",discard,_WeakVar1
+; CHECK: .section .data,"wd",discard,_WeakVar1
 ; CHECK: .globl _WeakVar1
 @WeakVar1 = weak_odr dllexport global i32 1, align 4
 
-; CHECK: .section .rdata,"r",discard,_WeakVar2
+; CHECK: .section .rdata,"rd",discard,_WeakVar2
 ; CHECK: .globl _WeakVar2
 @WeakVar2 = weak_odr dllexport unnamed_addr constant i32 1
 

Modified: llvm/trunk/test/CodeGen/X86/global-sections.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/global-sections.ll?rev=207028&r1=207027&r2=207028&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/global-sections.ll (original)
+++ llvm/trunk/test/CodeGen/X86/global-sections.ll Wed Apr 23 16:29:34 2014
@@ -48,7 +48,7 @@ define void @F1() {
 ; LINUX-SECTIONS: .section        .rodata.G3,"a", at progbits
 ; LINUX-SECTIONS: .globl  G3
 
-; WIN32-SECTIONS: .section        .rdata,"r",one_only,_G3
+; WIN32-SECTIONS: .section        .rdata,"rd",one_only,_G3
 ; WIN32-SECTIONS: .globl  _G3
 
 
@@ -127,7 +127,7 @@ define void @F1() {
 ; LINUX-SECTIONS: .section        .rodata.G7,"aMS", at progbits,1
 ; LINUX-SECTIONS:	.globl G7
 
-; WIN32-SECTIONS: .section        .rdata,"r",one_only,_G7
+; WIN32-SECTIONS: .section        .rdata,"rd",one_only,_G7
 ; WIN32-SECTIONS:	.globl _G7
 
 
@@ -190,7 +190,7 @@ define void @F1() {
 ; LINUX-SECTIONS:        .asciz  "foo"
 ; LINUX-SECTIONS:        .size   .LG14, 4
 
-; WIN32-SECTIONS:        .section        .rdata,"r"
+; WIN32-SECTIONS:        .section        .rdata,"rd"
 ; WIN32-SECTIONS: L_G14:
 ; WIN32-SECTIONS:        .asciz  "foo"
 

Modified: llvm/trunk/test/DebugInfo/COFF/asm.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/COFF/asm.ll?rev=207028&r1=207027&r2=207028&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/COFF/asm.ll (original)
+++ llvm/trunk/test/DebugInfo/COFF/asm.ll Wed Apr 23 16:29:34 2014
@@ -21,7 +21,7 @@
 ; X86-NEXT: ret
 ; X86-NEXT: [[END_OF_F:.*]]:
 ;
-; X86-LABEL: .section        .debug$S,"rn"
+; X86-LABEL: .section        .debug$S,"rnd"
 ; X86-NEXT: .long   4
 ; X86-NEXT: .long   242
 ; X86-NEXT: .long [[F2_END:.*]]-[[F2_START:.*]]
@@ -90,7 +90,7 @@
 ; X64-NEXT: ret
 ; X64-NEXT: [[END_OF_F:.*]]:
 ;
-; X64-LABEL: .section        .debug$S,"rn"
+; X64-LABEL: .section        .debug$S,"rnd"
 ; X64-NEXT: .long   4
 ; X64-NEXT: .long   242
 ; X64-NEXT: .long [[F2_END:.*]]-[[F2_START:.*]]

Modified: llvm/trunk/test/DebugInfo/COFF/multifile.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/COFF/multifile.ll?rev=207028&r1=207027&r2=207028&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/COFF/multifile.ll (original)
+++ llvm/trunk/test/DebugInfo/COFF/multifile.ll Wed Apr 23 16:29:34 2014
@@ -28,7 +28,7 @@
 ; X86-NEXT: ret
 ; X86-NEXT: [[END_OF_F:.*]]:
 ;
-; X86-LABEL: .section        .debug$S,"rn"
+; X86-LABEL: .section        .debug$S,"rnd"
 ; X86-NEXT: .long   4
 ; X86-NEXT: .long   242
 ; X86-NEXT: .long [[F2_END:.*]]-[[F2_START:.*]]
@@ -122,7 +122,7 @@
 ; X64-NEXT: ret
 ; X64-NEXT: [[END_OF_F:.*]]:
 ;
-; X64-LABEL: .section        .debug$S,"rn"
+; X64-LABEL: .section        .debug$S,"rnd"
 ; X64-NEXT: .long   4
 ; X64-NEXT: .long   242
 ; X64-NEXT: .long [[F2_END:.*]]-[[F2_START:.*]]

Modified: llvm/trunk/test/DebugInfo/COFF/multifunction.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/COFF/multifunction.ll?rev=207028&r1=207027&r2=207028&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/COFF/multifunction.ll (original)
+++ llvm/trunk/test/DebugInfo/COFF/multifunction.ll Wed Apr 23 16:29:34 2014
@@ -50,7 +50,7 @@
 ; X86-NEXT: ret
 ; X86-NEXT: [[END_OF_F:.*]]:
 ;
-; X86-LABEL: .section        .debug$S,"rn"
+; X86-LABEL: .section        .debug$S,"rnd"
 ; X86-NEXT: .long   4
 ; Line table subsection for x
 ; X86-NEXT: .long   242
@@ -200,7 +200,7 @@
 ; X64-NEXT: ret
 ; X64-NEXT: [[END_OF_F:.*]]:
 ;
-; X64-LABEL: .section        .debug$S,"rn"
+; X64-LABEL: .section        .debug$S,"rnd"
 ; X64-NEXT: .long   4
 ; Line table subsection for x
 ; X64-NEXT: .long   242

Modified: llvm/trunk/test/DebugInfo/COFF/simple.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/COFF/simple.ll?rev=207028&r1=207027&r2=207028&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/COFF/simple.ll (original)
+++ llvm/trunk/test/DebugInfo/COFF/simple.ll Wed Apr 23 16:29:34 2014
@@ -19,7 +19,7 @@
 ; X86-NEXT: ret
 ; X86-NEXT: [[END_OF_F:.*]]:
 ;
-; X86-LABEL: .section        .debug$S,"rn"
+; X86-LABEL: .section        .debug$S,"rnd"
 ; X86-NEXT: .long   4
 ; X86-NEXT: .long   242
 ; X86-NEXT: .long [[F2_END:.*]]-[[F2_START:.*]]
@@ -81,7 +81,7 @@
 ; X64-NEXT: ret
 ; X64-NEXT: [[END_OF_F:.*]]:
 ;
-; X64-LABEL: .section        .debug$S,"rn"
+; X64-LABEL: .section        .debug$S,"rnd"
 ; X64-NEXT: .long   4
 ; X64-NEXT: .long   242
 ; X64-NEXT: .long [[F2_END:.*]]-[[F2_START:.*]]

Modified: llvm/trunk/test/DebugInfo/COFF/tail-call-without-lexical-scopes.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/COFF/tail-call-without-lexical-scopes.ll?rev=207028&r1=207027&r2=207028&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/COFF/tail-call-without-lexical-scopes.ll (original)
+++ llvm/trunk/test/DebugInfo/COFF/tail-call-without-lexical-scopes.ll Wed Apr 23 16:29:34 2014
@@ -22,7 +22,7 @@
 ; X86-NEXT: [[END_OF_BAR:^L.*]]:{{$}}
 ; X86-NOT:  ret
 
-; X86-LABEL: .section        .debug$S,"rn"
+; X86-LABEL: .section        .debug$S,"rnd"
 ; X86:       .secrel32 "?bar@@YAXHZZ"
 ; X86-NEXT:  .secidx   "?bar@@YAXHZZ"
 ; X86:       .long   0

Modified: llvm/trunk/test/DebugInfo/X86/coff_debug_info_type.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/coff_debug_info_type.ll?rev=207028&r1=207027&r2=207028&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/coff_debug_info_type.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/coff_debug_info_type.ll Wed Apr 23 16:29:34 2014
@@ -4,7 +4,7 @@
 ; CHECK:    .section  .debug_info
 
 ; RUN: llc -mtriple=i686-pc-win32 -filetype=asm -O0 < %s | FileCheck -check-prefix=WIN32 %s
-; WIN32:    .section .debug$S,"rn"
+; WIN32:    .section .debug$S,"rnd"
 
 ; generated from:
 ; clang -g -S -emit-llvm test.c -o test.ll

Modified: llvm/trunk/test/MC/COFF/global_ctors_dtors.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/COFF/global_ctors_dtors.ll?rev=207028&r1=207027&r2=207028&view=diff
==============================================================================
--- llvm/trunk/test/MC/COFF/global_ctors_dtors.ll (original)
+++ llvm/trunk/test/MC/COFF/global_ctors_dtors.ll Wed Apr 23 16:29:34 2014
@@ -29,11 +29,11 @@ define i32 @main() nounwind {
   ret i32 0
 }
 
-; WIN32: .section .CRT$XCU,"r"
+; WIN32: .section .CRT$XCU,"rd"
 ; WIN32: a_global_ctor
-; WIN32: .section .CRT$XTX,"r"
+; WIN32: .section .CRT$XTX,"rd"
 ; WIN32: a_global_dtor
-; MINGW32: .section .ctors,"w"
+; MINGW32: .section .ctors,"wd"
 ; MINGW32: a_global_ctor
-; MINGW32: .section .dtors,"w"
+; MINGW32: .section .dtors,"wd"
 ; MINGW32: a_global_dtor

Modified: llvm/trunk/test/MC/COFF/weak-symbol.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/COFF/weak-symbol.ll?rev=207028&r1=207027&r2=207028&view=diff
==============================================================================
--- llvm/trunk/test/MC/COFF/weak-symbol.ll (original)
+++ llvm/trunk/test/MC/COFF/weak-symbol.ll Wed Apr 23 16:29:34 2014
@@ -28,20 +28,20 @@ define weak void @f() section ".sect" {
 }
 
 ; Weak global
-; X86: .section .data,"r",discard,_a
+; X86: .section .data,"rd",discard,_a
 ; X86: .globl _a
 ; X86: .zero 12
 ;
-; X64: .section .data,"r",discard,a
+; X64: .section .data,"rd",discard,a
 ; X64: .globl a
 ; X64: .zero 12
 @a = weak unnamed_addr constant { i32, i32, i32 } { i32 0, i32 0, i32 0}, section ".data"
 
-; X86:  .section        .tls$,"w",discard,_b
+; X86:  .section        .tls$,"wd",discard,_b
 ; X86:  .globl  _b
 ; X86:  .long   0
 ;
-; X64:  .section        .tls$,"w",discard,b
+; X64:  .section        .tls$,"wd",discard,b
 ; X64:  .globl  b
 ; X64:  .long   0
 





More information about the llvm-commits mailing list