@@ -425,7 +425,7 @@ pub fn maybe_create_entry_wrapper<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
425
425
426
426
let isize_ty = cx. type_isize ( ) ;
427
427
let ptr_ty = cx. type_ptr ( ) ;
428
- let ( arg_argc, arg_argv) = get_argc_argv ( cx , & mut bx) ;
428
+ let ( arg_argc, arg_argv) = get_argc_argv ( & mut bx) ;
429
429
430
430
let ( start_fn, start_ty, args, instance) = if let EntryFnType :: Main { sigpipe } = entry_type
431
431
{
@@ -468,33 +468,30 @@ pub fn maybe_create_entry_wrapper<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
468
468
}
469
469
470
470
/// Obtain the `argc` and `argv` values to pass to the rust start function.
471
- fn get_argc_argv < ' a , ' tcx , Bx : BuilderMethods < ' a , ' tcx > > (
472
- cx : & ' a Bx :: CodegenCx ,
473
- bx : & mut Bx ,
474
- ) -> ( Bx :: Value , Bx :: Value ) {
475
- if cx. sess ( ) . target . os . contains ( "uefi" ) {
471
+ fn get_argc_argv < ' a , ' tcx , Bx : BuilderMethods < ' a , ' tcx > > ( bx : & mut Bx ) -> ( Bx :: Value , Bx :: Value ) {
472
+ if bx. cx ( ) . sess ( ) . target . os . contains ( "uefi" ) {
476
473
// Params for UEFI
477
474
let param_handle = bx. get_param ( 0 ) ;
478
475
let param_system_table = bx. get_param ( 1 ) ;
479
476
let ptr_size = bx. tcx ( ) . data_layout . pointer_size ;
480
477
let ptr_align = bx. tcx ( ) . data_layout . pointer_align . abi ;
481
- let arg_argc = bx. const_int ( cx . type_isize ( ) , 2 ) ;
478
+ let arg_argc = bx. const_int ( bx . cx ( ) . type_isize ( ) , 2 ) ;
482
479
let arg_argv = bx. alloca ( 2 * ptr_size, ptr_align) ;
483
480
bx. store ( param_handle, arg_argv, ptr_align) ;
484
481
let arg_argv_el1 = bx. inbounds_ptradd ( arg_argv, bx. const_usize ( ptr_size. bytes ( ) ) ) ;
485
482
bx. store ( param_system_table, arg_argv_el1, ptr_align) ;
486
483
( arg_argc, arg_argv)
487
- } else if cx . sess ( ) . target . main_needs_argc_argv {
484
+ } else if bx . cx ( ) . sess ( ) . target . main_needs_argc_argv {
488
485
// Params from native `main()` used as args for rust start function
489
486
let param_argc = bx. get_param ( 0 ) ;
490
487
let param_argv = bx. get_param ( 1 ) ;
491
- let arg_argc = bx. intcast ( param_argc, cx . type_isize ( ) , true ) ;
488
+ let arg_argc = bx. intcast ( param_argc, bx . cx ( ) . type_isize ( ) , true ) ;
492
489
let arg_argv = param_argv;
493
490
( arg_argc, arg_argv)
494
491
} else {
495
492
// The Rust start function doesn't need `argc` and `argv`, so just pass zeros.
496
- let arg_argc = bx. const_int ( cx . type_int ( ) , 0 ) ;
497
- let arg_argv = bx. const_null ( cx . type_ptr ( ) ) ;
493
+ let arg_argc = bx. const_int ( bx . cx ( ) . type_int ( ) , 0 ) ;
494
+ let arg_argv = bx. const_null ( bx . cx ( ) . type_ptr ( ) ) ;
498
495
( arg_argc, arg_argv)
499
496
}
500
497
}
0 commit comments