1; RUN: llc < %s -mtriple=x86_64-unknown-freebsd9 | FileCheck %s 2 3; Check that our compiler never emits global constructors 4; inside the .init_array section when building for a non-Linux ELF target. 5; Because of this, the test depends on UseInitArray behavior under FreeBSD 6; as found in Generic_ELF::addClangTargetOptions(). 7 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. 13 14%class.C = type { i8 } 15%class.D = type { i8 } 16 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, void ()* }] [{ i32, void ()* } { i32 101, void ()* @_GLOBAL__I_000101 }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I_a }] 20 21define linkonce_odr void @_ZN1CC1Ev(%class.C* nocapture %this) { 22entry: 23 ret void 24} 25 26define linkonce_odr void @_ZN1DC1Ev(%class.D* nocapture %this) { 27entry: 28 ret void 29} 30 31define linkonce_odr void @_ZN1DC2Ev(%class.D* nocapture %this) { 32entry: 33 ret void 34} 35 36define linkonce_odr void @_ZN1CC2Ev(%class.C* nocapture %this) { 37entry: 38 ret void 39} 40 41define internal void @_GLOBAL__I_000101() nounwind readnone { 42entry: 43 ret void 44} 45 46define internal void @_GLOBAL__I_a() nounwind readnone { 47entry: 48 ret void 49} 50 51; CHECK-NOT: .init_array 52