1*9880d681SAndroid Build Coastguard Worker; RUN: llvm-as %s -o %t.o 2*9880d681SAndroid Build Coastguard Worker; RUN: %ld64 -lto_library %llvmshlibdir/libLTO.dylib -dylib -arch x86_64 -macosx_version_min 10.10.0 -lSystem -o %t.dylib %t.o -save-temps -undefined dynamic_lookup -exported_symbol _c -exported_symbol _b -exported_symbol _GlobLinkonce 3*9880d681SAndroid Build Coastguard Worker 4*9880d681SAndroid Build Coastguard Worker; RUN: llvm-dis %t.dylib.lto.opt.bc -o - | FileCheck --check-prefix=IR %s 5*9880d681SAndroid Build Coastguard Worker; check that @a is no longer a linkonce_odr definition 6*9880d681SAndroid Build Coastguard Worker; IR-NOT: define linkonce_odr void @a() 7*9880d681SAndroid Build Coastguard Worker; check that @b is appended in llvm.used 8*9880d681SAndroid Build Coastguard Worker; IR: @llvm.compiler.used = appending global [2 x i8*] [i8* bitcast ([1 x i8*]* @GlobLinkonce to i8*), i8* bitcast (void ()* @b to i8*)], section "llvm.metadata" 9*9880d681SAndroid Build Coastguard Worker 10*9880d681SAndroid Build Coastguard Worker; RUN: llvm-nm %t.dylib | FileCheck --check-prefix=NM %s 11*9880d681SAndroid Build Coastguard Worker; check that the linker can hide @a but not @b, nor @GlobLinkonce 12*9880d681SAndroid Build Coastguard Worker; NM: 0000000000000f48 S _GlobLinkonce 13*9880d681SAndroid Build Coastguard Worker; NM: 0000000000000f10 t _a 14*9880d681SAndroid Build Coastguard Worker; NM: 0000000000000f20 T _b 15*9880d681SAndroid Build Coastguard Worker; NM: 0000000000000f00 T _c 16*9880d681SAndroid Build Coastguard Worker 17*9880d681SAndroid Build Coastguard Worker 18*9880d681SAndroid Build Coastguard Workertarget triple = "x86_64-apple-macosx10.10.0" 19*9880d681SAndroid Build Coastguard Worker 20*9880d681SAndroid Build Coastguard Workerdeclare void @external() 21*9880d681SAndroid Build Coastguard Worker 22*9880d681SAndroid Build Coastguard Worker@GlobLinkonce = linkonce_odr unnamed_addr constant [1 x i8*] [i8* null], align 8 23*9880d681SAndroid Build Coastguard Worker 24*9880d681SAndroid Build Coastguard Workerdefine linkonce_odr void @a() noinline { 25*9880d681SAndroid Build Coastguard Worker %use_of_GlobLinkonce = load [1 x i8*], [1 x i8*] *@GlobLinkonce 26*9880d681SAndroid Build Coastguard Worker call void @external() 27*9880d681SAndroid Build Coastguard Worker ret void 28*9880d681SAndroid Build Coastguard Worker} 29*9880d681SAndroid Build Coastguard Worker 30*9880d681SAndroid Build Coastguard Workerdefine linkonce_odr void @b() { 31*9880d681SAndroid Build Coastguard Worker ret void 32*9880d681SAndroid Build Coastguard Worker} 33*9880d681SAndroid Build Coastguard Worker 34*9880d681SAndroid Build Coastguard Workerdefine void()* @c() { 35*9880d681SAndroid Build Coastguard Worker call void @a() 36*9880d681SAndroid Build Coastguard Worker ret void()* @b 37*9880d681SAndroid Build Coastguard Worker} 38