@@ -7,6 +7,7 @@ use rustc_codegen_ssa::traits::BaseTypeCodegenMethods as _;
7
7
use rustc_middle:: bug;
8
8
use rustc_middle:: ty:: TyCtxt ;
9
9
use rustc_session:: config:: { DebugInfo , OomStrategy } ;
10
+ use rustc_symbol_mangling:: mangle_internal_symbol;
10
11
11
12
use crate :: builder:: SBuilder ;
12
13
use crate :: declare:: declare_simple_fn;
@@ -53,8 +54,8 @@ pub(crate) unsafe fn codegen(
53
54
}
54
55
} ;
55
56
56
- let from_name = global_fn_name ( method. name ) ;
57
- let to_name = default_fn_name ( method. name ) ;
57
+ let from_name = mangle_internal_symbol ( tcx , & global_fn_name ( method. name ) ) ;
58
+ let to_name = mangle_internal_symbol ( tcx , & default_fn_name ( method. name ) ) ;
58
59
59
60
create_wrapper_function ( tcx, & cx, & from_name, & to_name, & args, output, false ) ;
60
61
}
@@ -64,24 +65,24 @@ pub(crate) unsafe fn codegen(
64
65
create_wrapper_function (
65
66
tcx,
66
67
& cx,
67
- "__rust_alloc_error_handler" ,
68
- alloc_error_handler_name ( alloc_error_handler_kind) ,
68
+ & mangle_internal_symbol ( tcx , "__rust_alloc_error_handler" ) ,
69
+ & mangle_internal_symbol ( tcx , alloc_error_handler_name ( alloc_error_handler_kind) ) ,
69
70
& [ usize, usize] , // size, align
70
71
None ,
71
72
true ,
72
73
) ;
73
74
74
75
unsafe {
75
76
// __rust_alloc_error_handler_should_panic
76
- let name = OomStrategy :: SYMBOL ;
77
- let ll_g = cx. declare_global ( name, i8) ;
77
+ let name = mangle_internal_symbol ( tcx , OomStrategy :: SYMBOL ) ;
78
+ let ll_g = cx. declare_global ( & name, i8) ;
78
79
llvm:: set_visibility ( ll_g, llvm:: Visibility :: from_generic ( tcx. sess . default_visibility ( ) ) ) ;
79
80
let val = tcx. sess . opts . unstable_opts . oom . should_panic ( ) ;
80
81
let llval = llvm:: LLVMConstInt ( i8, val as u64 , False ) ;
81
82
llvm:: set_initializer ( ll_g, llval) ;
82
83
83
- let name = NO_ALLOC_SHIM_IS_UNSTABLE ;
84
- let ll_g = cx. declare_global ( name, i8) ;
84
+ let name = mangle_internal_symbol ( tcx , NO_ALLOC_SHIM_IS_UNSTABLE ) ;
85
+ let ll_g = cx. declare_global ( & name, i8) ;
85
86
llvm:: set_visibility ( ll_g, llvm:: Visibility :: from_generic ( tcx. sess . default_visibility ( ) ) ) ;
86
87
let llval = llvm:: LLVMConstInt ( i8, 0 , False ) ;
87
88
llvm:: set_initializer ( ll_g, llval) ;
0 commit comments