@@ -8,6 +8,7 @@ use rustc_ast::expand::allocator::{
88use rustc_middle:: bug;
99use rustc_middle:: ty:: TyCtxt ;
1010use rustc_session:: config:: OomStrategy ;
11+ use rustc_symbol_mangling:: mangle_internal_symbol;
1112
1213use crate :: GccContext ;
1314#[ cfg( feature = "master" ) ]
@@ -53,8 +54,8 @@ pub(crate) unsafe fn codegen(
5354 panic ! ( "invalid allocator output" )
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, context, & from_name, & to_name, & types, output) ;
6061 }
@@ -64,13 +65,13 @@ pub(crate) unsafe fn codegen(
6465 create_wrapper_function (
6566 tcx,
6667 context,
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] ,
7071 None ,
7172 ) ;
7273
73- let name = OomStrategy :: SYMBOL . to_string ( ) ;
74+ let name = mangle_internal_symbol ( tcx , OomStrategy :: SYMBOL ) ;
7475 let global = context. new_global ( None , GlobalKind :: Exported , i8, name) ;
7576 #[ cfg( feature = "master" ) ]
7677 global. add_attribute ( VarAttribute :: Visibility ( symbol_visibility_to_gcc (
@@ -80,7 +81,7 @@ pub(crate) unsafe fn codegen(
8081 let value = context. new_rvalue_from_int ( i8, value as i32 ) ;
8182 global. global_set_initializer_rvalue ( value) ;
8283
83- let name = NO_ALLOC_SHIM_IS_UNSTABLE . to_string ( ) ;
84+ let name = mangle_internal_symbol ( tcx , NO_ALLOC_SHIM_IS_UNSTABLE ) ;
8485 let global = context. new_global ( None , GlobalKind :: Exported , i8, name) ;
8586 #[ cfg( feature = "master" ) ]
8687 global. add_attribute ( VarAttribute :: Visibility ( symbol_visibility_to_gcc (
0 commit comments