@@ -7,6 +7,7 @@ use rustc_ast::expand::allocator::{
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 :: debuginfo;
12
13
use crate :: llvm:: { self , Context , False , Module , True , Type } ;
@@ -54,8 +55,8 @@ pub(crate) unsafe fn codegen(
54
55
}
55
56
} ;
56
57
57
- let from_name = global_fn_name ( method. name ) ;
58
- let to_name = default_fn_name ( method. name ) ;
58
+ let from_name = mangle_internal_symbol ( tcx , & global_fn_name ( method. name ) ) ;
59
+ let to_name = mangle_internal_symbol ( tcx , & default_fn_name ( method. name ) ) ;
59
60
60
61
create_wrapper_function ( tcx, llcx, llmod, & from_name, & to_name, & args, output, false ) ;
61
62
}
@@ -66,15 +67,15 @@ pub(crate) unsafe fn codegen(
66
67
tcx,
67
68
llcx,
68
69
llmod,
69
- "__rust_alloc_error_handler" ,
70
- alloc_error_handler_name ( alloc_error_handler_kind) ,
70
+ & mangle_internal_symbol ( tcx , "__rust_alloc_error_handler" ) ,
71
+ & mangle_internal_symbol ( tcx , alloc_error_handler_name ( alloc_error_handler_kind) ) ,
71
72
& [ usize, usize] , // size, align
72
73
None ,
73
74
true ,
74
75
) ;
75
76
76
77
// __rust_alloc_error_handler_should_panic
77
- let name = OomStrategy :: SYMBOL ;
78
+ let name = mangle_internal_symbol ( tcx , OomStrategy :: SYMBOL ) ;
78
79
let ll_g = llvm:: LLVMRustGetOrInsertGlobal ( llmod, name. as_ptr ( ) . cast ( ) , name. len ( ) , i8) ;
79
80
if tcx. sess . default_hidden_visibility ( ) {
80
81
llvm:: LLVMRustSetVisibility ( ll_g, llvm:: Visibility :: Hidden ) ;
@@ -83,7 +84,7 @@ pub(crate) unsafe fn codegen(
83
84
let llval = llvm:: LLVMConstInt ( i8, val as u64 , False ) ;
84
85
llvm:: LLVMSetInitializer ( 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_ptr ( ) . cast ( ) , name. len ( ) , i8) ;
88
89
if tcx. sess . default_hidden_visibility ( ) {
89
90
llvm:: LLVMRustSetVisibility ( ll_g, llvm:: Visibility :: Hidden ) ;
0 commit comments