52 lines · plain
1; RUN: llc < %s -mtriple=x86_64-netbsd -use-ctors | FileCheck %s2 3; Check that our compiler never emits global constructors4; inside the .init_array section when building for a non supported target.5; Because of this, the test depends on UseInitArray behavior under NetBSD6; as found in Generic_ELF::addClangTargetOptions().7 8; This is to workaround a Visual Studio bug which causes field9; 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 constructor12; that explicitly initializes field UseInitArray.13 14%class.C = type { i8 }15%class.D = type { i8 }16 17@c1 = global %class.C zeroinitializer, align 118@d1 = global %class.D zeroinitializer, align 119@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 }]20 21define linkonce_odr void @_ZN1CC1Ev(ptr nocapture %this) {22entry:23 ret void24}25 26define linkonce_odr void @_ZN1DC1Ev(ptr nocapture %this) {27entry:28 ret void29}30 31define linkonce_odr void @_ZN1DC2Ev(ptr nocapture %this) {32entry:33 ret void34}35 36define linkonce_odr void @_ZN1CC2Ev(ptr nocapture %this) {37entry:38 ret void39}40 41define internal void @_GLOBAL__I_000101() nounwind readnone {42entry:43 ret void44}45 46define internal void @_GLOBAL__I_a() nounwind readnone {47entry:48 ret void49}50 51; CHECK-NOT: .init_array52