@@ -6,6 +6,7 @@ use rustc_ast::expand::allocator::{
6
6
use rustc_middle:: bug;
7
7
use rustc_middle:: ty:: TyCtxt ;
8
8
use rustc_session:: config:: { DebugInfo , OomStrategy } ;
9
+ use rustc_symbol_mangling:: mangle_internal_symbol;
9
10
10
11
use crate :: common:: AsCCharPtr ;
11
12
use crate :: llvm:: { self , Context , False , Module , True , Type } ;
@@ -55,8 +56,8 @@ pub(crate) unsafe fn codegen(
55
56
}
56
57
} ;
57
58
58
- let from_name = global_fn_name ( method. name ) ;
59
- let to_name = default_fn_name ( method. name ) ;
59
+ let from_name = mangle_internal_symbol ( tcx , & global_fn_name ( method. name ) ) ;
60
+ let to_name = mangle_internal_symbol ( tcx , & default_fn_name ( method. name ) ) ;
60
61
61
62
create_wrapper_function ( tcx, llcx, llmod, & from_name, & to_name, & args, output, false ) ;
62
63
}
@@ -67,23 +68,23 @@ pub(crate) unsafe fn codegen(
67
68
tcx,
68
69
llcx,
69
70
llmod,
70
- "__rust_alloc_error_handler" ,
71
- alloc_error_handler_name ( alloc_error_handler_kind) ,
71
+ & mangle_internal_symbol ( tcx , "__rust_alloc_error_handler" ) ,
72
+ & mangle_internal_symbol ( tcx , alloc_error_handler_name ( alloc_error_handler_kind) ) ,
72
73
& [ usize, usize] , // size, align
73
74
None ,
74
75
true ,
75
76
) ;
76
77
77
78
unsafe {
78
79
// __rust_alloc_error_handler_should_panic
79
- let name = OomStrategy :: SYMBOL ;
80
+ let name = mangle_internal_symbol ( tcx , OomStrategy :: SYMBOL ) ;
80
81
let ll_g = llvm:: LLVMRustGetOrInsertGlobal ( llmod, name. as_c_char_ptr ( ) , name. len ( ) , i8) ;
81
82
llvm:: set_visibility ( ll_g, llvm:: Visibility :: from_generic ( tcx. sess . default_visibility ( ) ) ) ;
82
83
let val = tcx. sess . opts . unstable_opts . oom . should_panic ( ) ;
83
84
let llval = llvm:: LLVMConstInt ( i8, val as u64 , False ) ;
84
85
llvm:: set_initializer ( ll_g, llval) ;
85
86
86
- let name = NO_ALLOC_SHIM_IS_UNSTABLE ;
87
+ let name = mangle_internal_symbol ( tcx , NO_ALLOC_SHIM_IS_UNSTABLE ) ;
87
88
let ll_g = llvm:: LLVMRustGetOrInsertGlobal ( llmod, name. as_c_char_ptr ( ) , name. len ( ) , i8) ;
88
89
llvm:: set_visibility ( ll_g, llvm:: Visibility :: from_generic ( tcx. sess . default_visibility ( ) ) ) ;
89
90
let llval = llvm:: LLVMConstInt ( i8, 0 , False ) ;
0 commit comments