1*9880d681SAndroid Build Coastguard Worker; RUN: llc -O0 -mtriple=x86_64-apple-darwin12 -filetype=obj -o - %s | llvm-readobj -s | FileCheck %s 2*9880d681SAndroid Build Coastguard Worker; Test that we emit weak_odr thread_locals correctly into the thread_bss section 3*9880d681SAndroid Build Coastguard Worker; PR15972 4*9880d681SAndroid Build Coastguard Worker 5*9880d681SAndroid Build Coastguard Worker; CHECK: Section { 6*9880d681SAndroid Build Coastguard Worker; CHECK: Index: 1 7*9880d681SAndroid Build Coastguard Worker; CHECK: Name: __thread_bss (5F 5F 74 68 72 65 61 64 5F 62 73 73 00 00 00 00) 8*9880d681SAndroid Build Coastguard Worker; CHECK: Size: 0x8 9*9880d681SAndroid Build Coastguard Worker; CHECK: Alignment: 3 10*9880d681SAndroid Build Coastguard Worker; CHECK: } 11*9880d681SAndroid Build Coastguard Worker; CHECK: Section { 12*9880d681SAndroid Build Coastguard Worker; CHECK: Index: 2 13*9880d681SAndroid Build Coastguard Worker; CHECK: Name: __thread_vars (5F 5F 74 68 72 65 61 64 5F 76 61 72 73 00 00 00) 14*9880d681SAndroid Build Coastguard Worker 15*9880d681SAndroid Build Coastguard Worker; Generated from this C++ source 16*9880d681SAndroid Build Coastguard Worker; template<class T> 17*9880d681SAndroid Build Coastguard Worker; struct Tls { 18*9880d681SAndroid Build Coastguard Worker; static __thread void* val; 19*9880d681SAndroid Build Coastguard Worker; }; 20*9880d681SAndroid Build Coastguard Worker 21*9880d681SAndroid Build Coastguard Worker; template<class T> __thread void* Tls<T>::val; 22*9880d681SAndroid Build Coastguard Worker 23*9880d681SAndroid Build Coastguard Worker; void* f(int x) { 24*9880d681SAndroid Build Coastguard Worker; return Tls<long>::val; 25*9880d681SAndroid Build Coastguard Worker; } 26*9880d681SAndroid Build Coastguard Worker 27*9880d681SAndroid Build Coastguard Worker@_ZN3TlsIlE3valE = weak_odr thread_local global i8* null, align 8 28*9880d681SAndroid Build Coastguard Worker 29*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind ssp uwtable 30*9880d681SAndroid Build Coastguard Workerdefine i8* @_Z1fi(i32 %x) #0 { 31*9880d681SAndroid Build Coastguard Workerentry: 32*9880d681SAndroid Build Coastguard Worker %x.addr = alloca i32, align 4 33*9880d681SAndroid Build Coastguard Worker store i32 %x, i32* %x.addr, align 4 34*9880d681SAndroid Build Coastguard Worker %0 = load i8*, i8** @_ZN3TlsIlE3valE, align 8 35*9880d681SAndroid Build Coastguard Worker ret i8* %0 36*9880d681SAndroid Build Coastguard Worker} 37*9880d681SAndroid Build Coastguard Worker 38*9880d681SAndroid Build Coastguard Workerattributes #0 = { nounwind ssp uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } 39