Skip to content

Commit

Permalink
Auto merge of #2532 - Enselic:fix-build-with-unix_sigpipe, r=RalfJung
Browse files Browse the repository at this point in the history
Fix build with `#[unix_sigpipe = "..."]` support in rustc

Closes rust-lang/rust#101352

CC `@RalfJung` `@oli-obk`
  • Loading branch information
bors committed Sep 3, 2022
2 parents dba35d2 + c011126 commit 9073179
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion rust-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
9353538c7bea6edb245457712cec720305c4576e
8c6ce6b91b172f77c795a74bfeaf74b865146b3f
11 changes: 9 additions & 2 deletions src/eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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 },
)?;
Expand Down

0 comments on commit 9073179

Please sign in to comment.