Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 9073179

Browse files
committed
Auto merge of rust-lang#2532 - Enselic:fix-build-with-unix_sigpipe, r=RalfJung
Fix build with `#[unix_sigpipe = "..."]` support in rustc Closes rust-lang#101352 CC `@RalfJung` `@oli-obk`
2 parents dba35d2 + c011126 commit 9073179

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

rust-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
9353538c7bea6edb245457712cec720305c4576e
1+
8c6ce6b91b172f77c795a74bfeaf74b865146b3f

src/eval.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ pub fn create_ecx<'mir, 'tcx: 'mir>(
277277
// Call start function.
278278

279279
match entry_type {
280-
EntryFnType::Main => {
280+
EntryFnType::Main { .. } => {
281281
let start_id = tcx.lang_items().start_fn().unwrap();
282282
let main_ret_ty = tcx.fn_sig(entry_id).output();
283283
let main_ret_ty = main_ret_ty.no_bound_vars().unwrap();
@@ -292,10 +292,17 @@ pub fn create_ecx<'mir, 'tcx: 'mir>(
292292

293293
let main_ptr = ecx.create_fn_alloc_ptr(FnVal::Instance(entry_instance));
294294

295+
let sigpipe = 2; // Inlining of `DEFAULT` from https://github.com/rust-lang/rust/blob/master/compiler/rustc_session/src/config/sigpipe.rs
296+
295297
ecx.call_function(
296298
start_instance,
297299
Abi::Rust,
298-
&[Scalar::from_pointer(main_ptr, &ecx).into(), argc.into(), argv],
300+
&[
301+
Scalar::from_pointer(main_ptr, &ecx).into(),
302+
argc.into(),
303+
argv,
304+
Scalar::from_u8(sigpipe).into(),
305+
],
299306
Some(&ret_place.into()),
300307
StackPopCleanup::Root { cleanup: true },
301308
)?;

0 commit comments

Comments
 (0)