|
1 | 1 | use libc::c_uint; |
2 | 2 | use rustc_ast::expand::allocator::{ |
3 | | - ALLOCATOR_METHODS, AllocatorKind, AllocatorTy, NO_ALLOC_SHIM_IS_UNSTABLE, |
4 | | - alloc_error_handler_name, default_fn_name, global_fn_name, |
| 3 | + ALLOC_ERROR_HANDLER, ALLOCATOR_METHODS, AllocatorKind, AllocatorTy, NO_ALLOC_SHIM_IS_UNSTABLE, |
| 4 | + default_fn_name, global_fn_name, |
5 | 5 | }; |
6 | 6 | use rustc_codegen_ssa::traits::BaseTypeCodegenMethods as _; |
7 | 7 | use rustc_middle::bug; |
@@ -83,17 +83,19 @@ pub(crate) unsafe fn codegen( |
83 | 83 | } |
84 | 84 | } |
85 | 85 |
|
86 | | - // rust alloc error handler |
87 | | - create_wrapper_function( |
88 | | - tcx, |
89 | | - &cx, |
90 | | - &mangle_internal_symbol(tcx, "__rust_alloc_error_handler"), |
91 | | - Some(&mangle_internal_symbol(tcx, alloc_error_handler_name(alloc_error_handler_kind))), |
92 | | - &[usize, usize], // size, align |
93 | | - None, |
94 | | - true, |
95 | | - &CodegenFnAttrs::new(), |
96 | | - ); |
| 86 | + if alloc_error_handler_kind == AllocatorKind::Default { |
| 87 | + // rust alloc error handler |
| 88 | + create_wrapper_function( |
| 89 | + tcx, |
| 90 | + &cx, |
| 91 | + &mangle_internal_symbol(tcx, &global_fn_name(ALLOC_ERROR_HANDLER)), |
| 92 | + Some(&mangle_internal_symbol(tcx, &default_fn_name(ALLOC_ERROR_HANDLER))), |
| 93 | + &[usize, usize], // size, align |
| 94 | + None, |
| 95 | + true, |
| 96 | + &CodegenFnAttrs::new(), |
| 97 | + ); |
| 98 | + } |
97 | 99 |
|
98 | 100 | // __rust_alloc_error_handler_should_panic_v2 |
99 | 101 | create_const_value_function( |
|
0 commit comments