|
3 | 3 |
|
4 | 4 | use cranelift_frontend::{FunctionBuilder, FunctionBuilderContext}; |
5 | 5 | use rustc_ast::expand::allocator::{ |
6 | | - ALLOCATOR_METHODS, AllocatorKind, AllocatorTy, NO_ALLOC_SHIM_IS_UNSTABLE, |
7 | | - alloc_error_handler_name, default_fn_name, global_fn_name, |
| 6 | + ALLOC_ERROR_HANDLER, ALLOCATOR_METHODS, AllocatorKind, AllocatorTy, NO_ALLOC_SHIM_IS_UNSTABLE, |
| 7 | + default_fn_name, global_fn_name, |
8 | 8 | }; |
9 | 9 | use rustc_codegen_ssa::base::allocator_kind_for_codegen; |
10 | 10 | use rustc_session::config::OomStrategy; |
@@ -72,17 +72,19 @@ fn codegen_inner( |
72 | 72 | } |
73 | 73 | } |
74 | 74 |
|
75 | | - let sig = Signature { |
76 | | - call_conv: module.target_config().default_call_conv, |
77 | | - params: vec![AbiParam::new(usize_ty), AbiParam::new(usize_ty)], |
78 | | - returns: vec![], |
79 | | - }; |
80 | | - crate::common::create_wrapper_function( |
81 | | - module, |
82 | | - sig, |
83 | | - &mangle_internal_symbol(tcx, "__rust_alloc_error_handler"), |
84 | | - &mangle_internal_symbol(tcx, alloc_error_handler_name(alloc_error_handler_kind)), |
85 | | - ); |
| 75 | + if alloc_error_handler_kind == AllocatorKind::Default { |
| 76 | + let sig = Signature { |
| 77 | + call_conv: module.target_config().default_call_conv, |
| 78 | + params: vec![AbiParam::new(usize_ty), AbiParam::new(usize_ty)], |
| 79 | + returns: vec![], |
| 80 | + }; |
| 81 | + crate::common::create_wrapper_function( |
| 82 | + module, |
| 83 | + sig, |
| 84 | + &mangle_internal_symbol(tcx, &global_fn_name(ALLOC_ERROR_HANDLER)), |
| 85 | + &mangle_internal_symbol(tcx, &default_fn_name(ALLOC_ERROR_HANDLER)), |
| 86 | + ); |
| 87 | + } |
86 | 88 |
|
87 | 89 | { |
88 | 90 | let sig = Signature { |
|
0 commit comments