1; Test that global ctors are emitted into the proper COFF section for the 2; target. Mingw uses .ctors, whereas MSVC uses .CRT$XC*. 3; RUN: llc < %s -mtriple i686-pc-win32 | FileCheck %s --check-prefix WIN32 4; RUN: llc < %s -mtriple x86_64-pc-win32 | FileCheck %s --check-prefix WIN32 5; RUN: llc < %s -mtriple i686-pc-mingw32 | FileCheck %s --check-prefix MINGW32 6; RUN: llc < %s -mtriple x86_64-pc-mingw32 | FileCheck %s --check-prefix MINGW32 7 8@.str = private unnamed_addr constant [13 x i8] c"constructing\00", align 1 9@.str2 = private unnamed_addr constant [12 x i8] c"destructing\00", align 1 10@.str3 = private unnamed_addr constant [5 x i8] c"main\00", align 1 11 12%ini = type { i32, void()*, i8* } 13 14@llvm.global_ctors = appending global [3 x %ini ] [ 15 %ini { i32 65535, void ()* @a_global_ctor, i8* null }, 16 %ini { i32 65535, void ()* @b_global_ctor, i8* bitcast (i32* @b to i8*) }, 17 %ini { i32 65535, void ()* @c_global_ctor, i8* bitcast (i32* @c to i8*) } 18] 19@llvm.global_dtors = appending global [1 x %ini ] [%ini { i32 65535, void ()* @a_global_dtor, i8* null }] 20 21declare i32 @puts(i8*) 22 23define void @a_global_ctor() nounwind { 24 %1 = call i32 @puts(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i32 0, i32 0)) 25 ret void 26} 27 28@b = global i32 zeroinitializer 29 30@c = available_externally dllimport global i32 zeroinitializer 31 32define void @b_global_ctor() nounwind { 33 store i32 42, i32* @b 34 ret void 35} 36 37define void @c_global_ctor() nounwind { 38 store i32 42, i32* @c 39 ret void 40} 41 42define void @a_global_dtor() nounwind { 43 %1 = call i32 @puts(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str2, i32 0, i32 0)) 44 ret void 45} 46 47define i32 @main() nounwind { 48 %1 = call i32 @puts(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str3, i32 0, i32 0)) 49 ret i32 0 50} 51 52; WIN32: .section .CRT$XCU,"dr" 53; WIN32: a_global_ctor 54; WIN32: .section .CRT$XCU,"dr",associative,{{_?}}b 55; WIN32: b_global_ctor 56; WIN32-NOT: c_global_ctor 57; WIN32: .section .CRT$XTX,"dr" 58; WIN32: a_global_dtor 59; MINGW32: .section .ctors,"dw" 60; MINGW32: a_global_ctor 61; MINGW32: .section .ctors,"dw",associative,{{_?}}b 62; MINGW32: b_global_ctor 63; MINGW32-NOT: c_global_ctor 64; MINGW32: .section .dtors,"dw" 65; MINGW32: a_global_dtor 66