@@ -153,7 +153,7 @@ pub(crate) fn codegen_const_value<'tcx>(
153
153
if fx. clif_comments . enabled ( ) {
154
154
fx. add_comment ( local_data_id, format ! ( "{:?}" , alloc_id) ) ;
155
155
}
156
- fx. bcx . ins ( ) . global_value ( fx. pointer_type , local_data_id)
156
+ fx. bcx . ins ( ) . symbol_value ( fx. pointer_type , local_data_id)
157
157
}
158
158
}
159
159
GlobalAlloc :: Function { instance, .. } => {
@@ -174,7 +174,7 @@ pub(crate) fn codegen_const_value<'tcx>(
174
174
) ;
175
175
let local_data_id =
176
176
fx. module . declare_data_in_func ( data_id, & mut fx. bcx . func ) ;
177
- fx. bcx . ins ( ) . global_value ( fx. pointer_type , local_data_id)
177
+ fx. bcx . ins ( ) . symbol_value ( fx. pointer_type , local_data_id)
178
178
}
179
179
GlobalAlloc :: TypeId { .. } => {
180
180
return CValue :: const_val (
@@ -195,7 +195,16 @@ pub(crate) fn codegen_const_value<'tcx>(
195
195
if fx. clif_comments . enabled ( ) {
196
196
fx. add_comment ( local_data_id, format ! ( "{:?}" , def_id) ) ;
197
197
}
198
- fx. bcx . ins ( ) . global_value ( fx. pointer_type , local_data_id)
198
+ if fx
199
+ . tcx
200
+ . codegen_fn_attrs ( def_id)
201
+ . flags
202
+ . contains ( CodegenFnAttrFlags :: THREAD_LOCAL )
203
+ {
204
+ fx. bcx . ins ( ) . tls_value ( fx. pointer_type , local_data_id)
205
+ } else {
206
+ fx. bcx . ins ( ) . symbol_value ( fx. pointer_type , local_data_id)
207
+ }
199
208
}
200
209
} ;
201
210
let val = if offset. bytes ( ) != 0 {
@@ -229,7 +238,7 @@ fn pointer_for_allocation<'tcx>(fx: &mut FunctionCx<'_, '_, 'tcx>, alloc_id: All
229
238
if fx. clif_comments . enabled ( ) {
230
239
fx. add_comment ( local_data_id, format ! ( "{:?}" , alloc_id) ) ;
231
240
}
232
- fx. bcx . ins ( ) . global_value ( fx. pointer_type , local_data_id)
241
+ fx. bcx . ins ( ) . symbol_value ( fx. pointer_type , local_data_id)
233
242
}
234
243
235
244
fn data_id_for_alloc_id (
0 commit comments