1 ; RUN: llc < %s -mtriple=x86_64-netbsd -use-ctors | FileCheck %s
3 ; Check that our compiler never emits global constructors
4 ; inside the .init_array section when building for a non supported target.
5 ; Because of this, the test depends on UseInitArray behavior under NetBSD
6 ; as found in Generic_ELF::addClangTargetOptions().
8 ; This is to workaround a Visual Studio bug which causes field
9 ; UseInitArray to be left uninitialized instead of being
10 ; zero-initialized (as specified in [dcl.init]p7).
11 ; This workaround consists in providing a user default constructor
12 ; that explicitly initializes field UseInitArray.
14 %class.C = type { i8 }
15 %class.D = type { i8 }
17 @c1 = global %class.C zeroinitializer, align 1
18 @d1 = global %class.D zeroinitializer, align 1
19 @llvm.global_ctors = appending global [2 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 101, ptr @_GLOBAL__I_000101, ptr null }, { i32, ptr, ptr } { i32 65535, ptr @_GLOBAL__I_a, ptr null }]
21 define linkonce_odr void @_ZN1CC1Ev(ptr nocapture %this) {
26 define linkonce_odr void @_ZN1DC1Ev(ptr nocapture %this) {
31 define linkonce_odr void @_ZN1DC2Ev(ptr nocapture %this) {
36 define linkonce_odr void @_ZN1CC2Ev(ptr nocapture %this) {
41 define internal void @_GLOBAL__I_000101() nounwind readnone {
46 define internal void @_GLOBAL__I_a() nounwind readnone {
51 ; CHECK-NOT: .init_array