Skip to content

Commit 92570c9

Browse files
committed
Rebase Rust and Cargo patches on 1.72.1
1 parent 3a38d5c commit 92570c9

9 files changed

+114
-103
lines changed

0001-Set-proper-llvm-targets.patch

+10-10
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@ Subject: [PATCH] Set proper llvm targets.
66
Signed-off-by: Matti Kosola <[email protected]>
77
Signed-off-by: Ruben De Smet <[email protected]>
88
---
9-
config.toml.example | 2 +-
9+
config.example.toml | 2 +-
1010
1 file changed, 1 insertion(+), 1 deletion(-)
1111

12-
diff --git a/config.toml.example b/config.toml.example
13-
index 6e53d9b442f1609ec929f1c021984391d038e879..02b3a376409f5e523921aca8c89c2922c950aab3 100644
14-
--- a/config.toml.example
15-
+++ b/config.toml.example
16-
@@ -103,7 +103,7 @@ changelog-seen = 2
17-
# support. You'll need to write a target specification at least, and most
18-
# likely, teach rustc about the C ABI of the target. Get in touch with the
19-
# Rust team and file an issue if you need assistance in porting!
20-
-#targets = "AArch64;ARM;BPF;Hexagon;MSP430;Mips;NVPTX;PowerPC;RISCV;Sparc;SystemZ;WebAssembly;X86"
12+
diff --git a/config.example.toml b/config.example.toml
13+
index 0c65b25fe13..43beaed6e7b 100644
14+
--- a/config.example.toml
15+
+++ b/config.example.toml
16+
@@ -88,7 +88,7 @@ changelog-seen = 2
17+
# the resulting rustc being unable to compile for the disabled architectures.
18+
#
19+
# To add support for new targets, see https://rustc-dev-guide.rust-lang.org/building/new-target.html.
20+
-#targets = "AArch64;ARM;BPF;Hexagon;LoongArch;MSP430;Mips;NVPTX;PowerPC;RISCV;Sparc;SystemZ;WebAssembly;X86"
2121
+targets = "X86;ARM;AArch64"
2222

2323
# LLVM experimental targets to build support for. These targets are specified in

0002-Disable-statx-for-all-builds.-JB-50106.patch

+9-6
Original file line numberDiff line numberDiff line change
@@ -16,40 +16,43 @@ Signed-off-by: Tomi Leppänen <[email protected]
1616
Signed-off-by: Matti Kosola <[email protected]>
1717
Signed-off-by: Ruben De Smet <[email protected]>
1818
---
19-
library/std/src/sys/unix/fs.rs | 27 ++-------------------------
20-
1 file changed, 2 insertions(+), 25 deletions(-)
19+
library/std/src/sys/unix/fs.rs | 32 ++------------------------------
20+
1 file changed, 2 insertions(+), 30 deletions(-)
2121

2222
diff --git a/library/std/src/sys/unix/fs.rs b/library/std/src/sys/unix/fs.rs
23-
index 7181451de575fcb8ff7df27ba5a66b18a08904be..141e1726db49f1ac483a5788bdbc31388a1c942e 100644
23+
index fbc7f04ce9a..bf49ad70590 100644
2424
--- a/library/std/src/sys/unix/fs.rs
2525
+++ b/library/std/src/sys/unix/fs.rs
26-
@@ -13,25 +13,11 @@
26+
@@ -28,28 +28,11 @@
2727
use crate::sys::{cvt, cvt_r};
2828
use crate::sys_common::{AsInner, AsInnerMut, FromInner, IntoInner};
2929

3030
-#[cfg(any(
3131
- all(target_os = "linux", target_env = "gnu"),
3232
- target_os = "macos",
3333
- target_os = "ios",
34+
- target_os = "tvos",
3435
- target_os = "watchos",
3536
-))]
3637
-use crate::sys::weak::syscall;
37-
#[cfg(any(target_os = "android", target_os = "macos"))]
38+
#[cfg(any(target_os = "android", target_os = "macos", target_os = "solaris"))]
3839
use crate::sys::weak::weak;
3940

4041
use libc::{c_int, mode_t};
4142

4243
-#[cfg(any(
4344
- target_os = "macos",
4445
- target_os = "ios",
46+
- target_os = "tvos",
4547
- target_os = "watchos",
48+
- target_os = "solaris",
4649
- all(target_os = "linux", target_env = "gnu")
4750
-))]
4851
-use libc::c_char;
4952
#[cfg(any(target_os = "linux", target_os = "emscripten", target_os = "android"))]
5053
use libc::dirfd;
5154
#[cfg(any(target_os = "linux", target_os = "emscripten"))]
52-
@@ -87,20 +73,9 @@
55+
@@ -109,20 +92,9 @@
5356
// https://github.com/rust-lang/rust/pull/67774
5457
macro_rules! cfg_has_statx {
5558
({ $($then_tt:tt)* } else { $($else_tt:tt)* }) => {

0003-Scratchbox2-needs-to-be-able-to-tell-rustc-the-defau.patch

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ Signed-off-by: Ruben De Smet <[email protected]>
1515
1 file changed, 8 insertions(+), 1 deletion(-)
1616

1717
diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs
18-
index 4182a5d07118e0652ff63c4bec28bde0775d0c59..9904ab2e70d7aafab4ec63e86d0cdb383ca2285b 100644
18+
index f97cb3440d2..9b96d0d2e57 100644
1919
--- a/compiler/rustc_session/src/config.rs
2020
+++ b/compiler/rustc_session/src/config.rs
21-
@@ -1848,7 +1848,14 @@ pub fn parse_target_triple(
21+
@@ -2170,7 +2170,14 @@ pub fn parse_target_triple(
2222
})
2323
}
2424
Some(target) => TargetTriple::TargetTriple(target),

0004-Force-the-target-when-building-for-CompileKind-Host.patch

+4-3
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,16 @@ Signed-off-by: Ruben De Smet <[email protected]>
1212
1 file changed, 1 insertion(+), 1 deletion(-)
1313

1414
diff --git a/src/tools/cargo/src/cargo/core/compiler/mod.rs b/src/tools/cargo/src/cargo/core/compiler/mod.rs
15+
index 31e63c226..976b101fd 100644
1516
--- a/src/tools/cargo/src/cargo/core/compiler/mod.rs
1617
+++ b/src/tools/cargo/src/cargo/core/compiler/mod.rs
17-
@@ -989,6 +989,9 @@ fn build_base_args(
18-
18+
@@ -1111,6 +1111,9 @@ fn build_base_args(cx: &Context<'_, '_>, cmd: &mut ProcessBuilder, unit: &Unit)
19+
1920
if let CompileKind::Target(n) = unit.kind {
2021
cmd.arg("--target").arg(n.rustc_target());
2122
+ } else {
2223
+ debug!("kind is {:?} - Forcing this to be 686", unit.kind);
2324
+ cmd.arg("--target").arg("i686-unknown-linux-gnu");
2425
}
25-
26+
2627
opt(

0005-Provide-ENV-controls-to-bypass-some-sb2-calls-betwee.patch

+39-36
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
22
From: David Greaves <[email protected]>
33
Date: Wed, 20 Jan 2021 09:40:34 +0000
4-
Subject: [PATCH] Provide ENV controls to bypass some sb2 calls between fork
5-
exec
4+
Subject: [PATCH] Provide ENV controls to bypass some sb2 calls between
5+
fork exec
66

77
In threaded systems there can be deadlocks caused by calling malloc
88
after fork and before exec. Rust manages this but sb2 does not.
@@ -35,15 +35,15 @@ needed to support the SHIM functionality
3535
Signed-off-by: David Greaves <[email protected]>
3636
Signed-off-by: Ruben De Smet <[email protected]>
3737
---
38-
.../src/sys/unix/process/process_common.rs | 50 ++++++-
38+
.../src/sys/unix/process/process_common.rs | 55 ++++++-
3939
.../std/src/sys/unix/process/process_unix.rs | 138 ++++++++++++++++--
40-
2 files changed, 170 insertions(+), 18 deletions(-)
40+
2 files changed, 173 insertions(+), 20 deletions(-)
4141

4242
diff --git a/library/std/src/sys/unix/process/process_common.rs b/library/std/src/sys/unix/process/process_common.rs
43-
index 27bee714f5b4317132db508fe916c7e194d05bc5..7746177e0423b7689833cc84b6132240a8bb2bf0 100644
43+
index 640648e8707..f15625e0514 100644
4444
--- a/library/std/src/sys/unix/process/process_common.rs
4545
+++ b/library/std/src/sys/unix/process/process_common.rs
46-
@@ -61,7 +61,7 @@ cfg_if::cfg_if! {
46+
@@ -84,7 +84,7 @@ pub unsafe fn sigaddset(set: *mut libc::sigset_t, signum: libc::c_int) -> libc::
4747
////////////////////////////////////////////////////////////////////////////////
4848

4949
pub struct Command {
@@ -52,7 +52,7 @@ index 27bee714f5b4317132db508fe916c7e194d05bc5..7746177e0423b7689833cc84b6132240
5252
args: Vec<CString>,
5353
/// Exactly what will be passed to `execvp`.
5454
///
55-
@@ -70,6 +70,13 @@ pub struct Command {
55+
@@ -93,6 +93,13 @@ pub struct Command {
5656
/// `args` to properly update this as well.
5757
argv: Argv,
5858
env: CommandEnv,
@@ -64,9 +64,9 @@ index 27bee714f5b4317132db508fe916c7e194d05bc5..7746177e0423b7689833cc84b6132240
6464
+ pub(crate) setgid: Option<SetgidFn>,
6565
+ pub(crate) setgroups: Option<SetgroupsFn>,
6666

67+
program_kind: ProgramKind,
6768
cwd: Option<CString>,
68-
uid: Option<uid_t>,
69-
@@ -85,6 +92,14 @@ pub struct Command {
69+
@@ -109,6 +116,14 @@ pub struct Command {
7070
pgroup: Option<pid_t>,
7171
}
7272

@@ -81,18 +81,18 @@ index 27bee714f5b4317132db508fe916c7e194d05bc5..7746177e0423b7689833cc84b6132240
8181
// Create a new type for argv, so that we can make it `Send` and `Sync`
8282
struct Argv(Vec<*const c_char>);
8383

84-
@@ -132,15 +147,23 @@ impl Command {
85-
pub fn new(program: &OsStr) -> Command {
84+
@@ -181,16 +196,24 @@ pub fn new(program: &OsStr) -> Command {
8685
let mut saw_nul = false;
86+
let program_kind = ProgramKind::new(program.as_ref());
8787
let program = os2c(program, &mut saw_nul);
8888
+ let arg0 = program.clone();
8989
Command {
9090
- argv: Argv(vec![program.as_ptr(), ptr::null()]),
9191
- args: vec![program.clone()],
92-
- program,
9392
+ argv: Argv(vec![arg0.as_ptr(), ptr::null()]),
9493
+ args: vec![arg0],
95-
+ program: program,
94+
program,
95+
program_kind,
9696
env: Default::default(),
9797
+ execvp: None,
9898
+ dup2: None,
@@ -109,18 +109,18 @@ index 27bee714f5b4317132db508fe916c7e194d05bc5..7746177e0423b7689833cc84b6132240
109109
closures: Vec::new(),
110110
groups: None,
111111
stdin: None,
112-
@@ -154,15 +177,23 @@ impl Command {
113-
pub fn new(program: &OsStr) -> Command {
112+
@@ -205,16 +228,24 @@ pub fn new(program: &OsStr) -> Command {
114113
let mut saw_nul = false;
114+
let program_kind = ProgramKind::new(program.as_ref());
115115
let program = os2c(program, &mut saw_nul);
116116
+ let arg0 = program.clone();
117117
Command {
118118
- argv: Argv(vec![program.as_ptr(), ptr::null()]),
119119
- args: vec![program.clone()],
120-
- program,
121120
+ argv: Argv(vec![arg0.as_ptr(), ptr::null()]),
122121
+ args: vec![arg0],
123-
+ program: program,
122+
program,
123+
program_kind,
124124
env: Default::default(),
125125
+ execvp: None,
126126
+ dup2: None,
@@ -137,7 +137,7 @@ index 27bee714f5b4317132db508fe916c7e194d05bc5..7746177e0423b7689833cc84b6132240
137137
closures: Vec::new(),
138138
groups: None,
139139
stdin: None,
140-
@@ -173,6 +204,16 @@ impl Command {
140+
@@ -225,6 +256,16 @@ pub fn new(program: &OsStr) -> Command {
141141
}
142142
}
143143

@@ -155,18 +155,21 @@ index 27bee714f5b4317132db508fe916c7e194d05bc5..7746177e0423b7689833cc84b6132240
155155
// Set a new arg0
156156
let arg = os2c(arg, &mut self.saw_nul);
157157
diff --git a/library/std/src/sys/unix/process/process_unix.rs b/library/std/src/sys/unix/process/process_unix.rs
158-
index 3d305cd7310fd4b8419d220d1adeadebb9fda914..5d1c667b943cb2af0e0e918c17a7b24293617376 100644
158+
index 0ce93af66ac..04449d859bf 100644
159159
--- a/library/std/src/sys/unix/process/process_unix.rs
160160
+++ b/library/std/src/sys/unix/process/process_unix.rs
161-
@@ -27,11 +27,15 @@
161+
@@ -28,7 +28,7 @@
162162
use libc::RTP_ID as pid_t;
163163

164164
#[cfg(not(target_os = "vxworks"))]
165165
-use libc::{c_int, pid_t};
166166
+use libc::{c_char, c_int, dlsym, pid_t};
167167

168-
#[cfg(not(any(target_os = "vxworks", target_os = "l4re")))]
169-
use libc::{gid_t, uid_t};
168+
#[cfg(not(any(
169+
target_os = "vxworks",
170+
@@ -65,6 +65,10 @@ fn get_clock_resolution() -> Duration {
171+
}
172+
}
170173

171174
+use crate::ffi::OsString;
172175
+use crate::intrinsics::transmute;
@@ -175,8 +178,8 @@ index 3d305cd7310fd4b8419d220d1adeadebb9fda914..5d1c667b943cb2af0e0e918c17a7b242
175178
////////////////////////////////////////////////////////////////////////////////
176179
// Command
177180
////////////////////////////////////////////////////////////////////////////////
178-
@@ -61,6 +65,65 @@ pub fn spawn(
179-
181+
@@ -93,6 +97,65 @@ pub fn spawn(
182+
}
180183
let (input, output) = sys::pipe::anon_pipe()?;
181184

182185
+ // If there is a RUST_EXEC_SHIM (could be "/usr/bin/env --")
@@ -241,16 +244,16 @@ index 3d305cd7310fd4b8419d220d1adeadebb9fda914..5d1c667b943cb2af0e0e918c17a7b242
241244
// Whatever happens after the fork is almost for sure going to touch or
242245
// look at the environment in one way or another (PATH in `execvp` or
243246
// accessing the `environ` pointer ourselves). Make sure no other thread
244-
@@ -76,7 +139,7 @@ pub fn spawn(
247+
@@ -109,7 +172,7 @@ pub fn spawn(
245248
if pid == 0 {
246249
crate::panic::always_abort();
247-
mem::forget(env_lock);
250+
mem::forget(env_lock); // avoid non-async-signal-safe unlocking
248251
- drop(input);
249252
+ self.unwrap_drop(input);
250253
let Err(err) = unsafe { self.do_exec(theirs, envp.as_ref()) };
251254
let errno = err.raw_os_error().unwrap_or(libc::EINVAL) as u32;
252255
let errno = errno.to_be_bytes();
253-
@@ -243,7 +306,48 @@ pub fn exec(&mut self, default: Stdio) -> io::Error {
256+
@@ -336,7 +399,48 @@ pub fn exec(&mut self, default: Stdio) -> io::Error {
254257
Err(e) => e,
255258
}
256259
}
@@ -300,7 +303,7 @@ index 3d305cd7310fd4b8419d220d1adeadebb9fda914..5d1c667b943cb2af0e0e918c17a7b242
300303
// And at this point we've reached a special time in the life of the
301304
// child. The child must now be considered hamstrung and unable to
302305
// do anything other than syscalls really. Consider the following
303-
@@ -282,13 +386,13 @@ unsafe fn do_exec(
306+
@@ -376,13 +480,13 @@ unsafe fn do_exec(
304307
use crate::sys::{self, cvt_r};
305308

306309
if let Some(fd) = stdio.stdin.fd() {
@@ -317,7 +320,7 @@ index 3d305cd7310fd4b8419d220d1adeadebb9fda914..5d1c667b943cb2af0e0e918c17a7b242
317320
}
318321

319322
#[cfg(not(target_os = "l4re"))]
320-
@@ -296,10 +400,10 @@ unsafe fn do_exec(
323+
@@ -390,10 +494,10 @@ unsafe fn do_exec(
321324
if let Some(_g) = self.get_groups() {
322325
//FIXME: Redox kernel does not support setgroups yet
323326
#[cfg(not(target_os = "redox"))]
@@ -330,12 +333,12 @@ index 3d305cd7310fd4b8419d220d1adeadebb9fda914..5d1c667b943cb2af0e0e918c17a7b242
330333
}
331334
if let Some(u) = self.get_uid() {
332335
// When dropping privileges from root, the `setgroups` call
333-
@@ -311,13 +415,13 @@ unsafe fn do_exec(
336+
@@ -405,13 +509,13 @@ unsafe fn do_exec(
334337
//FIXME: Redox kernel does not support setgroups yet
335338
#[cfg(not(target_os = "redox"))]
336339
if libc::getuid() == 0 && self.get_groups().is_none() {
337-
- cvt(libc::setgroups(0, ptr::null()))?;
338-
+ cvt(self.unwrap_setgroups(0, ptr::null()))?;
340+
- cvt(libc::setgroups(0, crate::ptr::null()))?;
341+
+ cvt(self.unwrap_setgroups(0, crate::ptr::null()))?;
339342
}
340343
- cvt(libc::setuid(u as uid_t))?;
341344
+ cvt(self.unwrap_setuid(u as uid_t))?;
@@ -347,7 +350,7 @@ index 3d305cd7310fd4b8419d220d1adeadebb9fda914..5d1c667b943cb2af0e0e918c17a7b242
347350
}
348351

349352
if let Some(pgroup) = self.get_pgroup() {
350-
@@ -378,8 +482,12 @@ fn drop(&mut self) {
353+
@@ -469,8 +573,12 @@ fn drop(&mut self) {
351354
_reset = Some(Reset(*sys::os::environ()));
352355
*sys::os::environ() = envp.as_ptr();
353356
}
@@ -362,17 +365,17 @@ index 3d305cd7310fd4b8419d220d1adeadebb9fda914..5d1c667b943cb2af0e0e918c17a7b242
362365
Err(io::Error::last_os_error())
363366
}
364367

365-
@@ -394,6 +502,7 @@ fn posix_spawn(
368+
@@ -497,6 +605,7 @@ fn posix_spawn(
366369
_: &ChildPipes,
367370
_: Option<&CStringArray>,
368371
) -> io::Result<Option<Process>> {
369372
+ eprintln!("process_unix:270: in null posix_spawn");
370373
Ok(None)
371374
}
372375

373-
@@ -413,12 +522,15 @@ fn posix_spawn(
376+
@@ -520,12 +629,15 @@ fn posix_spawn(
374377
use crate::mem::MaybeUninit;
375-
use crate::sys::{self, cvt_nz};
378+
use crate::sys::{self, cvt_nz, unix_sigpipe_attr_specified};
376379

377380
+ let skip_spawnvp: bool = getenv(&OsString::from("SB2_RUST_NO_SPAWNVP")).is_some();
378381
+

0006-Scratchbox2-needs-to-be-able-to-tell-cargo-the-defau.patch

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ Signed-off-by: Ruben De Smet <[email protected]>
1212
1 file changed, 1 insertion(+), 1 deletion(-)
1313

1414
diff --git a/src/tools/cargo/src/cargo/core/compiler/compile_kind.rs b/src/tools/cargo/src/cargo/core/compiler/compile_kind.rs
15-
index c3c921d41..d8a08582a 100644
15+
index 73d8f89cc..d35f55d11 100644
1616
--- a/src/tools/cargo/src/cargo/core/compiler/compile_kind.rs
1717
+++ b/src/tools/cargo/src/cargo/core/compiler/compile_kind.rs
18-
@@ -72,7 +72,13 @@ impl CompileKind {
18+
@@ -71,7 +71,13 @@ impl CompileKind {
1919
}
2020

2121
let kinds = match &config.build_config()?.target {
@@ -26,6 +26,6 @@ index c3c921d41..d8a08582a 100644
2626
+ } else {
2727
+ Ok(vec![CompileKind::Host])
2828
+ }
29-
+ },
29+
+ }
3030
Some(build_target_config) => dedup(&build_target_config.values(config)?),
3131
};

0007-Disable-aarch64-outline-atomics-for-now.patch

+6-5
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,19 @@ The feature causes linking problems.
1010

1111
Signed-off-by: Matti Lehtimäki <[email protected]>
1212
---
13-
compiler/rustc_target/src/spec/aarch64_unknown_linux_gnu.rs | 1 -
14-
1 file changed, 1 deletion(-)
13+
compiler/rustc_target/src/spec/aarch64_unknown_linux_gnu.rs | 2 +-
14+
1 file changed, 1 insertion(+), 1 deletion(-)
1515

1616
diff --git a/compiler/rustc_target/src/spec/aarch64_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/aarch64_unknown_linux_gnu.rs
17-
index 3006044d5..6ef7b596e 100644
17+
index da246089440..8c5daccc331 100644
1818
--- a/compiler/rustc_target/src/spec/aarch64_unknown_linux_gnu.rs
1919
+++ b/compiler/rustc_target/src/spec/aarch64_unknown_linux_gnu.rs
20-
@@ -7,7 +7,6 @@ pub fn target() -> Target {
20+
@@ -7,7 +7,7 @@ pub fn target() -> Target {
2121
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(),
2222
arch: "aarch64".into(),
2323
options: TargetOptions {
24-
- features: "+outline-atomics".into(),
24+
- features: "+v8a,+outline-atomics".into(),
25+
+ features: "+v8a".into(),
2526
mcount: "\u{1}_mcount".into(),
2627
max_atomic_width: Some(128),
2728
supported_sanitizers: SanitizerSet::ADDRESS

0 commit comments

Comments
 (0)