diff options
| author | Martin Nordholts <enselic@gmail.com> | 2022-09-03 06:44:20 +0200 |
|---|---|---|
| committer | Martin Nordholts <enselic@gmail.com> | 2022-09-03 12:23:05 +0200 |
| commit | c011126f1a286c5867e9d18005362e0cd1d221cb (patch) | |
| tree | a87300f6cab6ecab065ac4fd9561640b57ad474b | |
| parent | dba35d2be72f4b78343d1a0f0b4737306f310672 (diff) | |
| download | rust-c011126f1a286c5867e9d18005362e0cd1d221cb.tar.gz rust-c011126f1a286c5867e9d18005362e0cd1d221cb.zip | |
Fix build with `#[unix_sigpipe = "..."]` support in rustc
| -rw-r--r-- | rust-version | 2 | ||||
| -rw-r--r-- | src/eval.rs | 11 |
2 files changed, 10 insertions, 3 deletions
diff --git a/rust-version b/rust-version index 0b9f9bba0ad..1b1d2b0f2b5 100644 --- a/rust-version +++ b/rust-version @@ -1 +1 @@ -9353538c7bea6edb245457712cec720305c4576e +8c6ce6b91b172f77c795a74bfeaf74b865146b3f diff --git a/src/eval.rs b/src/eval.rs index f7bc11a445d..bf04e427131 100644 --- a/src/eval.rs +++ b/src/eval.rs @@ -277,7 +277,7 @@ pub fn create_ecx<'mir, 'tcx: 'mir>( // Call start function. match entry_type { - EntryFnType::Main => { + EntryFnType::Main { .. } => { let start_id = tcx.lang_items().start_fn().unwrap(); let main_ret_ty = tcx.fn_sig(entry_id).output(); let main_ret_ty = main_ret_ty.no_bound_vars().unwrap(); @@ -292,10 +292,17 @@ pub fn create_ecx<'mir, 'tcx: 'mir>( let main_ptr = ecx.create_fn_alloc_ptr(FnVal::Instance(entry_instance)); + let sigpipe = 2; // Inlining of `DEFAULT` from https://github.com/rust-lang/rust/blob/master/compiler/rustc_session/src/config/sigpipe.rs + ecx.call_function( start_instance, Abi::Rust, - &[Scalar::from_pointer(main_ptr, &ecx).into(), argc.into(), argv], + &[ + Scalar::from_pointer(main_ptr, &ecx).into(), + argc.into(), + argv, + Scalar::from_u8(sigpipe).into(), + ], Some(&ret_place.into()), StackPopCleanup::Root { cleanup: true }, )?; |
