|
2 | 2 | use gccjit::FnAttribute; |
3 | 3 | use gccjit::{Context, FunctionType, RValue, ToRValue, Type}; |
4 | 4 | use rustc_ast::expand::allocator::{ |
5 | | - ALLOCATOR_METHODS, AllocatorKind, AllocatorTy, NO_ALLOC_SHIM_IS_UNSTABLE, |
6 | | - alloc_error_handler_name, default_fn_name, global_fn_name, |
| 5 | + ALLOC_ERROR_HANDLER, ALLOCATOR_METHODS, AllocatorKind, AllocatorTy, NO_ALLOC_SHIM_IS_UNSTABLE, |
| 6 | + default_fn_name, global_fn_name, |
7 | 7 | }; |
8 | 8 | use rustc_middle::bug; |
9 | 9 | use rustc_middle::ty::TyCtxt; |
@@ -61,15 +61,17 @@ pub(crate) unsafe fn codegen( |
61 | 61 | } |
62 | 62 | } |
63 | 63 |
|
64 | | - // FIXME(bjorn3): Add noreturn attribute |
65 | | - create_wrapper_function( |
66 | | - tcx, |
67 | | - context, |
68 | | - &mangle_internal_symbol(tcx, "__rust_alloc_error_handler"), |
69 | | - Some(&mangle_internal_symbol(tcx, alloc_error_handler_name(alloc_error_handler_kind))), |
70 | | - &[usize, usize], |
71 | | - None, |
72 | | - ); |
| 64 | + if alloc_error_handler_kind == AllocatorKind::Default { |
| 65 | + // FIXME(bjorn3): Add noreturn attribute |
| 66 | + create_wrapper_function( |
| 67 | + tcx, |
| 68 | + context, |
| 69 | + &mangle_internal_symbol(tcx, &global_fn_name(ALLOC_ERROR_HANDLER)), |
| 70 | + Some(&mangle_internal_symbol(tcx, &default_fn_name(ALLOC_ERROR_HANDLER))), |
| 71 | + &[usize, usize], |
| 72 | + None, |
| 73 | + ); |
| 74 | + } |
73 | 75 |
|
74 | 76 | create_const_value_function( |
75 | 77 | tcx, |
|
0 commit comments