@@ -5,11 +5,10 @@ use rustc_ast::expand::allocator::{AllocatorKind, AllocatorTy, ALLOCATOR_METHODS
5
5
use rustc_middle:: bug;
6
6
use rustc_middle:: ty:: TyCtxt ;
7
7
use rustc_session:: config:: OomStrategy ;
8
- use rustc_span:: symbol:: sym;
9
8
10
9
use crate :: GccContext ;
11
10
12
- pub ( crate ) unsafe fn codegen ( tcx : TyCtxt < ' _ > , mods : & mut GccContext , _module_name : & str , kind : AllocatorKind , alloc_error_handler_kind : AllocatorKind ) {
11
+ pub ( crate ) unsafe fn codegen ( tcx : TyCtxt < ' _ > , mods : & mut GccContext , _module_name : & str , kind : AllocatorKind ) {
13
12
let context = & mods. context ;
14
13
let usize =
15
14
match tcx. sess . target . pointer_width {
@@ -87,37 +86,6 @@ pub(crate) unsafe fn codegen(tcx: TyCtxt<'_>, mods: &mut GccContext, _module_nam
87
86
// as described in https://github.com/rust-lang/rust/commit/77a96ed5646f7c3ee8897693decc4626fe380643
88
87
}
89
88
90
- let types = [ usize, usize] ;
91
- let name = "__rust_alloc_error_handler" . to_string ( ) ;
92
- let args: Vec < _ > = types. iter ( ) . enumerate ( )
93
- . map ( |( index, typ) | context. new_parameter ( None , * typ, & format ! ( "param{}" , index) ) )
94
- . collect ( ) ;
95
- let func = context. new_function ( None , FunctionType :: Exported , void, & args, name, false ) ;
96
-
97
- if tcx. sess . target . default_hidden_visibility {
98
- #[ cfg( feature="master" ) ]
99
- func. add_attribute ( FnAttribute :: Visibility ( gccjit:: Visibility :: Hidden ) ) ;
100
- }
101
-
102
- let callee = alloc_error_handler_kind. fn_name ( sym:: oom) ;
103
- let args: Vec < _ > = types. iter ( ) . enumerate ( )
104
- . map ( |( index, typ) | context. new_parameter ( None , * typ, & format ! ( "param{}" , index) ) )
105
- . collect ( ) ;
106
- let callee = context. new_function ( None , FunctionType :: Extern , void, & args, callee, false ) ;
107
- #[ cfg( feature="master" ) ]
108
- callee. add_attribute ( FnAttribute :: Visibility ( gccjit:: Visibility :: Hidden ) ) ;
109
-
110
- let block = func. new_block ( "entry" ) ;
111
-
112
- let args = args
113
- . iter ( )
114
- . enumerate ( )
115
- . map ( |( i, _) | func. get_param ( i as i32 ) . to_rvalue ( ) )
116
- . collect :: < Vec < _ > > ( ) ;
117
- let _ret = context. new_call ( None , callee, & args) ;
118
- //llvm::LLVMSetTailCall(ret, True);
119
- block. end_with_void_return ( None ) ;
120
-
121
89
let name = OomStrategy :: SYMBOL . to_string ( ) ;
122
90
let global = context. new_global ( None , GlobalKind :: Exported , i8, name) ;
123
91
let value = tcx. sess . opts . unstable_opts . oom . should_panic ( ) ;
0 commit comments