@@ -7,6 +7,7 @@ use rustc_ast::expand::allocator::{
77use rustc_middle:: bug;
88use rustc_middle:: ty:: TyCtxt ;
99use rustc_session:: config:: { DebugInfo , OomStrategy } ;
10+ use rustc_symbol_mangling:: mangle_internal_symbol;
1011
1112use crate :: debuginfo;
1213use crate :: llvm:: { self , Context , False , Module , True , Type } ;
@@ -54,8 +55,8 @@ pub(crate) unsafe fn codegen(
5455 }
5556 } ;
5657
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 ) ) ;
5960
6061 create_wrapper_function ( tcx, llcx, llmod, & from_name, & to_name, & args, output, false ) ;
6162 }
@@ -66,15 +67,15 @@ pub(crate) unsafe fn codegen(
6667 tcx,
6768 llcx,
6869 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) ) ,
7172 & [ usize, usize] , // size, align
7273 None ,
7374 true ,
7475 ) ;
7576
7677 // __rust_alloc_error_handler_should_panic
77- let name = OomStrategy :: SYMBOL ;
78+ let name = mangle_internal_symbol ( tcx , OomStrategy :: SYMBOL ) ;
7879 let ll_g = llvm:: LLVMRustGetOrInsertGlobal ( llmod, name. as_ptr ( ) . cast ( ) , name. len ( ) , i8) ;
7980 if tcx. sess . default_hidden_visibility ( ) {
8081 llvm:: LLVMRustSetVisibility ( ll_g, llvm:: Visibility :: Hidden ) ;
@@ -83,7 +84,7 @@ pub(crate) unsafe fn codegen(
8384 let llval = llvm:: LLVMConstInt ( i8, val as u64 , False ) ;
8485 llvm:: LLVMSetInitializer ( ll_g, llval) ;
8586
86- let name = NO_ALLOC_SHIM_IS_UNSTABLE ;
87+ let name = mangle_internal_symbol ( tcx , NO_ALLOC_SHIM_IS_UNSTABLE ) ;
8788 let ll_g = llvm:: LLVMRustGetOrInsertGlobal ( llmod, name. as_ptr ( ) . cast ( ) , name. len ( ) , i8) ;
8889 if tcx. sess . default_hidden_visibility ( ) {
8990 llvm:: LLVMRustSetVisibility ( ll_g, llvm:: Visibility :: Hidden ) ;
0 commit comments