@@ -7,6 +7,7 @@ use rustc_codegen_ssa::traits::BaseTypeCodegenMethods as _;
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 :: builder:: SBuilder ;
1213use crate :: declare:: declare_simple_fn;
@@ -53,8 +54,8 @@ pub(crate) unsafe fn codegen(
5354 }
5455 } ;
5556
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 ) ) ;
5859
5960 create_wrapper_function ( tcx, & cx, & from_name, & to_name, & args, output, false ) ;
6061 }
@@ -64,24 +65,24 @@ pub(crate) unsafe fn codegen(
6465 create_wrapper_function (
6566 tcx,
6667 & 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) ) ,
6970 & [ usize, usize] , // size, align
7071 None ,
7172 true ,
7273 ) ;
7374
7475 unsafe {
7576 // __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) ;
7879 llvm:: set_visibility ( ll_g, llvm:: Visibility :: from_generic ( tcx. sess . default_visibility ( ) ) ) ;
7980 let val = tcx. sess . opts . unstable_opts . oom . should_panic ( ) ;
8081 let llval = llvm:: LLVMConstInt ( i8, val as u64 , False ) ;
8182 llvm:: set_initializer ( ll_g, llval) ;
8283
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) ;
8586 llvm:: set_visibility ( ll_g, llvm:: Visibility :: from_generic ( tcx. sess . default_visibility ( ) ) ) ;
8687 let llval = llvm:: LLVMConstInt ( i8, 0 , False ) ;
8788 llvm:: set_initializer ( ll_g, llval) ;
0 commit comments