Skip to content

Commit 52d654a

Browse files
committed
[rust] Rust 1.79.0
1 parent 7300bd5 commit 52d654a

11 files changed

+137
-100
lines changed

0001-Set-proper-llvm-targets.patch

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,24 @@ Subject: [PATCH] Set proper llvm targets.
55

66
Signed-off-by: Matti Kosola <[email protected]>
77
Signed-off-by: Ruben De Smet <[email protected]>
8+
Signed-off-by: Matti Viljanen <[email protected]>
89
---
910
config.example.toml | 2 +-
1011
1 file changed, 1 insertion(+), 1 deletion(-)
1112

1213
diff --git a/config.example.toml b/config.example.toml
13-
index e5df28a49af..48a9fafea6f 100644
14+
index 5c1fac767..9a090fd33 100644
1415
--- a/config.example.toml
1516
+++ b/config.example.toml
16-
@@ -99,7 +99,7 @@ change-id = 116881
17+
@@ -96,7 +96,7 @@
1718
# the resulting rustc being unable to compile for the disabled architectures.
1819
#
1920
# To add support for new targets, see https://rustc-dev-guide.rust-lang.org/building/new-target.html.
2021
-#targets = "AArch64;ARM;BPF;Hexagon;LoongArch;MSP430;Mips;NVPTX;PowerPC;RISCV;Sparc;SystemZ;WebAssembly;X86"
2122
+targets = "X86;ARM;AArch64"
22-
23+
2324
# LLVM experimental targets to build support for. These targets are specified in
2425
# the same format as above, but since these targets are experimental, they are
25-
--
26-
2.43.0
26+
--
27+
2.45.2
2728

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,16 @@ allows the same rustc binary to be used for all builds.
1010

1111
Signed-off-by: David Greaves <[email protected]>
1212
Signed-off-by: Ruben De Smet <[email protected]>
13+
Signed-off-by: Matti Viljanen <[email protected]>
1314
---
1415
compiler/rustc_session/src/config.rs | 9 ++++++++-
1516
1 file changed, 8 insertions(+), 1 deletion(-)
1617

1718
diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs
18-
index f745bc390ca..934f16ab4ab 100644
19+
index 4f259960a..16defdafb 100644
1920
--- a/compiler/rustc_session/src/config.rs
2021
+++ b/compiler/rustc_session/src/config.rs
21-
@@ -2241,7 +2241,14 @@ pub fn parse_target_triple(
22+
@@ -1922,7 +1922,14 @@ pub fn parse_target_triple(early_dcx: &EarlyDiagCtxt, matches: &getopts::Matches
2223
})
2324
}
2425
Some(target) => TargetTriple::TargetTriple(target),
@@ -33,7 +34,7 @@ index f745bc390ca..934f16ab4ab 100644
3334
+ }
3435
}
3536
}
36-
37-
--
38-
2.43.0
37+
38+
--
39+
2.45.2
3940

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

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,25 @@ Currently hardwired to be i686-unknown-linux-gnu
77

88
Signed-off-by: David Greaves <[email protected]>
99
Signed-off-by: Ruben De Smet <[email protected]>
10+
Signed-off-by: Matti Viljanen <[email protected]>
1011
---
11-
src/tools/cargo | 2 +-
12-
1 file changed, 1 insertion(+), 1 deletion(-)
12+
src/tools/cargo/src/cargo/core/compiler/mod.rs | 3 +++
13+
1 file changed, 3 insertions(+)
1314

1415
diff --git a/src/tools/cargo/src/cargo/core/compiler/mod.rs b/src/tools/cargo/src/cargo/core/compiler/mod.rs
15-
index 7024a2ac5..ebce975a9 100644
16+
index 3b0510ac9..6b745db92 100644
1617
--- a/src/tools/cargo/src/cargo/core/compiler/mod.rs
1718
+++ b/src/tools/cargo/src/cargo/core/compiler/mod.rs
18-
@@ -1111,6 +1111,9 @@ fn build_base_args(cx: &Context<'_, '_>, cmd: &mut ProcessBuilder, unit: &Unit)
19-
19+
@@ -1150,6 +1150,9 @@ fn build_base_args(
20+
2021
if let CompileKind::Target(n) = unit.kind {
2122
cmd.arg("--target").arg(n.rustc_target());
2223
+ } else {
2324
+ debug!("kind is {:?} - Forcing this to be 686", unit.kind);
2425
+ cmd.arg("--target").arg("i686-unknown-linux-gnu");
2526
}
26-
27+
2728
opt(
28-
--
29-
2.42.0
29+
--
30+
2.45.2
3031

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

Lines changed: 53 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,19 @@ needed to support the SHIM functionality
3535
Co-authored-by: Ruben De Smet <[email protected]>
3636
Signed-off-by: David Greaves <[email protected]>
3737
Signed-off-by: Ruben De Smet <[email protected]>
38+
Signed-off-by: Matti Viljanen <[email protected]>
3839
---
39-
.../src/sys/unix/process/process_common.rs | 55 ++++++-
40-
.../std/src/sys/unix/process/process_unix.rs | 137 ++++++++++++++++--
40+
.../sys/pal/unix/process/process_common.rs | 55 ++++++-
41+
.../src/sys/pal/unix/process/process_unix.rs | 137 ++++++++++++++++--
4142
2 files changed, 172 insertions(+), 20 deletions(-)
4243

43-
diff --git a/library/std/src/sys/unix/process/process_common.rs b/library/std/src/sys/unix/process/process_common.rs
44-
index bac32d9e60e..3cd9767da88 100644
45-
--- a/library/std/src/sys/unix/process/process_common.rs
46-
+++ b/library/std/src/sys/unix/process/process_common.rs
47-
@@ -85,7 +85,7 @@ pub unsafe fn sigaddset(set: *mut libc::sigset_t, signum: libc::c_int) -> libc::
44+
diff --git a/library/std/src/sys/pal/unix/process/process_common.rs b/library/std/src/sys/pal/unix/process/process_common.rs
45+
index f615e8086..7e90aa40f 100644
46+
--- a/library/std/src/sys/pal/unix/process/process_common.rs
47+
+++ b/library/std/src/sys/pal/unix/process/process_common.rs
48+
@@ -85,7 +85,7 @@ cfg_if::cfg_if! {
4849
////////////////////////////////////////////////////////////////////////////////
49-
50+
5051
pub struct Command {
5152
- program: CString,
5253
+ pub(crate) program: CString,
@@ -64,13 +65,13 @@ index bac32d9e60e..3cd9767da88 100644
6465
+ pub(crate) setuid: Option<SetuidFn>,
6566
+ pub(crate) setgid: Option<SetgidFn>,
6667
+ pub(crate) setgroups: Option<SetgroupsFn>,
67-
68+
6869
program_kind: ProgramKind,
6970
cwd: Option<CString>,
7071
@@ -110,6 +117,14 @@ pub struct Command {
7172
pgroup: Option<pid_t>,
7273
}
73-
74+
7475
+pub(crate) type ExecvpFn = fn(*const c_char, *const *const c_char) -> c_int;
7576
+pub(crate) type Dup2Fn = fn(c_int, c_int) -> c_int;
7677
+pub(crate) type CloseFn = fn(c_int) -> c_int;
@@ -81,8 +82,8 @@ index bac32d9e60e..3cd9767da88 100644
8182
+
8283
// Create a new type for argv, so that we can make it `Send` and `Sync`
8384
struct Argv(Vec<*const c_char>);
84-
85-
@@ -183,16 +198,24 @@ pub fn new(program: &OsStr) -> Command {
85+
86+
@@ -183,16 +198,24 @@ impl Command {
8687
let mut saw_nul = false;
8788
let program_kind = ProgramKind::new(program.as_ref());
8889
let program = os2c(program, &mut saw_nul);
@@ -110,7 +111,7 @@ index bac32d9e60e..3cd9767da88 100644
110111
closures: Vec::new(),
111112
groups: None,
112113
stdin: None,
113-
@@ -207,16 +230,24 @@ pub fn new(program: &OsStr) -> Command {
114+
@@ -207,16 +230,24 @@ impl Command {
114115
let mut saw_nul = false;
115116
let program_kind = ProgramKind::new(program.as_ref());
116117
let program = os2c(program, &mut saw_nul);
@@ -138,10 +139,10 @@ index bac32d9e60e..3cd9767da88 100644
138139
closures: Vec::new(),
139140
groups: None,
140141
stdin: None,
141-
@@ -227,6 +258,16 @@ pub fn new(program: &OsStr) -> Command {
142+
@@ -227,6 +258,16 @@ impl Command {
142143
}
143144
}
144-
145+
145146
+ // This allows process_unix::{spawn, exec} to push program to the
146147
+ // start of /usr/bin/env's arg list
147148
+ pub fn insert_program(&mut self, arg: String) {
@@ -155,34 +156,34 @@ index bac32d9e60e..3cd9767da88 100644
155156
pub fn set_arg_0(&mut self, arg: &OsStr) {
156157
// Set a new arg0
157158
let arg = os2c(arg, &mut self.saw_nul);
158-
diff --git a/library/std/src/sys/unix/process/process_unix.rs b/library/std/src/sys/unix/process/process_unix.rs
159-
index 72aca4e6659..495368b58ec 100644
160-
--- a/library/std/src/sys/unix/process/process_unix.rs
161-
+++ b/library/std/src/sys/unix/process/process_unix.rs
162-
@@ -25,7 +25,7 @@
159+
diff --git a/library/std/src/sys/pal/unix/process/process_unix.rs b/library/std/src/sys/pal/unix/process/process_unix.rs
160+
index d65657790..9b2f68b8c 100644
161+
--- a/library/std/src/sys/pal/unix/process/process_unix.rs
162+
+++ b/library/std/src/sys/pal/unix/process/process_unix.rs
163+
@@ -15,7 +15,7 @@ use crate::os::unix::io::AsRawFd;
163164
use libc::RTP_ID as pid_t;
164-
165+
165166
#[cfg(not(target_os = "vxworks"))]
166167
-use libc::{c_int, pid_t};
167168
+use libc::{c_char, c_int, dlsym, pid_t};
168-
169+
169170
#[cfg(not(any(
170171
target_os = "vxworks",
171-
@@ -62,6 +62,10 @@ fn get_clock_resolution() -> Duration {
172+
@@ -52,6 +52,10 @@ cfg_if::cfg_if! {
172173
}
173174
}
174-
175+
175176
+use crate::ffi::OsString;
176177
+use crate::intrinsics::transmute;
177178
+use sys::os::getenv;
178179
+
179180
////////////////////////////////////////////////////////////////////////////////
180181
// Command
181182
////////////////////////////////////////////////////////////////////////////////
182-
@@ -95,6 +99,65 @@ pub fn spawn(
183+
@@ -85,6 +89,65 @@ impl Command {
183184
#[cfg(not(target_os = "linux"))]
184185
let (input, output) = sys::pipe::anon_pipe()?;
185-
186+
186187
+ // If there is a RUST_EXEC_SHIM (could be "/usr/bin/env --")
187188
+ // then we're probably going to directly execvp it via dlsym
188189
+ // to avoid issues with threads and malloc post-fork and
@@ -245,7 +246,7 @@ index 72aca4e6659..495368b58ec 100644
245246
// Whatever happens after the fork is almost for sure going to touch or
246247
// look at the environment in one way or another (PATH in `execvp` or
247248
// accessing the `environ` pointer ourselves). Make sure no other thread
248-
@@ -111,7 +174,7 @@ pub fn spawn(
249+
@@ -101,7 +164,7 @@ impl Command {
249250
if pid == 0 {
250251
crate::panic::always_abort();
251252
mem::forget(env_lock); // avoid non-async-signal-safe unlocking
@@ -254,7 +255,7 @@ index 72aca4e6659..495368b58ec 100644
254255
#[cfg(target_os = "linux")]
255256
if self.get_create_pidfd() {
256257
self.send_pidfd(&output);
257-
@@ -268,7 +331,47 @@ pub fn exec(&mut self, default: Stdio) -> io::Error {
258+
@@ -257,7 +320,47 @@ impl Command {
258259
Err(e) => e,
259260
}
260261
}
@@ -303,9 +304,9 @@ index 72aca4e6659..495368b58ec 100644
303304
// And at this point we've reached a special time in the life of the
304305
// child. The child must now be considered hamstrung and unable to
305306
// do anything other than syscalls really. Consider the following
306-
@@ -308,13 +411,13 @@ unsafe fn do_exec(
307+
@@ -297,13 +400,13 @@ impl Command {
307308
use crate::sys::{self, cvt_r};
308-
309+
309310
if let Some(fd) = stdio.stdin.fd() {
310311
- cvt_r(|| libc::dup2(fd, libc::STDIN_FILENO))?;
311312
+ cvt_r(|| self.unwrap_dup2(fd, libc::STDIN_FILENO))?;
@@ -318,9 +319,9 @@ index 72aca4e6659..495368b58ec 100644
318319
- cvt_r(|| libc::dup2(fd, libc::STDERR_FILENO))?;
319320
+ cvt_r(|| self.unwrap_dup2(fd, libc::STDERR_FILENO))?;
320321
}
321-
322+
322323
#[cfg(not(target_os = "l4re"))]
323-
@@ -322,10 +425,10 @@ unsafe fn do_exec(
324+
@@ -311,10 +414,10 @@ impl Command {
324325
if let Some(_g) = self.get_groups() {
325326
//FIXME: Redox kernel does not support setgroups yet
326327
#[cfg(not(target_os = "redox"))]
@@ -333,12 +334,18 @@ index 72aca4e6659..495368b58ec 100644
333334
}
334335
if let Some(u) = self.get_uid() {
335336
// When dropping privileges from root, the `setgroups` call
336-
@@ -337,13 +440,13 @@ unsafe fn do_exec(
337+
@@ -326,7 +429,7 @@ impl Command {
337338
//FIXME: Redox kernel does not support setgroups yet
338339
#[cfg(not(target_os = "redox"))]
339-
if libc::getuid() == 0 && self.get_groups().is_none() {
340-
- cvt(libc::setgroups(0, crate::ptr::null()))?;
341-
+ cvt(self.unwrap_setgroups(0, crate::ptr::null()))?;
340+
if self.get_groups().is_none() {
341+
- let res = cvt(libc::setgroups(0, crate::ptr::null()));
342+
+ let res = cvt(self.unwrap_setgroups(0, crate::ptr::null()));
343+
if let Err(e) = res {
344+
// Here we ignore the case of not having CAP_SETGID.
345+
// An alternative would be to require CAP_SETGID (in
346+
@@ -336,11 +439,11 @@ impl Command {
347+
}
348+
}
342349
}
343350
- cvt(libc::setuid(u as uid_t))?;
344351
+ cvt(self.unwrap_setuid(u as uid_t))?;
@@ -348,9 +355,9 @@ index 72aca4e6659..495368b58ec 100644
348355
- cvt(libc::chdir(cwd.as_ptr()))?;
349356
+ cvt(self.unwrap_chdir(cwd.as_ptr()))?;
350357
}
351-
358+
352359
if let Some(pgroup) = self.get_pgroup() {
353-
@@ -408,8 +511,12 @@ fn drop(&mut self) {
360+
@@ -405,8 +508,12 @@ impl Command {
354361
_reset = Some(Reset(*sys::os::environ()));
355362
*sys::os::environ() = envp.as_ptr();
356363
}
@@ -364,19 +371,19 @@ index 72aca4e6659..495368b58ec 100644
364371
+ };
365372
Err(io::Error::last_os_error())
366373
}
367-
368-
@@ -436,6 +543,7 @@ fn posix_spawn(
374+
375+
@@ -433,6 +540,7 @@ impl Command {
369376
_: &ChildPipes,
370377
_: Option<&CStringArray>,
371378
) -> io::Result<Option<Process>> {
372379
+ eprintln!("process_unix:270: in null posix_spawn");
373380
Ok(None)
374381
}
375-
376-
@@ -459,12 +567,15 @@ fn posix_spawn(
377-
use crate::mem::MaybeUninit;
382+
383+
@@ -457,12 +565,15 @@ impl Command {
384+
use crate::sys::weak::weak;
378385
use crate::sys::{self, cvt_nz, unix_sigpipe_attr_specified};
379-
386+
380387
+ let skip_spawnvp: bool = getenv(&OsString::from("SB2_RUST_NO_SPAWNVP")).is_some();
381388
+
382389
if self.get_gid().is_some()
@@ -389,6 +396,6 @@ index 72aca4e6659..495368b58ec 100644
389396
{
390397
return Ok(None);
391398
}
392-
--
393-
2.43.0
399+
--
400+
2.45.2
394401

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

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,30 @@ Subject: [PATCH] Scratchbox2 needs to be able to tell cargo the default
77
This is analogous to the SB2 patch to rustc; ac226bbc018e11311394126fe580763c5bc77a2c
88

99
Signed-off-by: Ruben De Smet <[email protected]>
10+
Signed-off-by: Matti Viljanen <[email protected]>
1011
---
11-
src/tools/cargo | 2 +-
12-
1 file changed, 1 insertion(+), 1 deletion(-)
12+
src/tools/cargo/src/cargo/core/compiler/compile_kind.rs | 8 +++++++-
13+
1 file changed, 7 insertions(+), 1 deletion(-)
1314

1415
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 73d8f89cc..5d17c15d2 100644
16+
index 222732dde..a5056be7b 100644
1617
--- a/src/tools/cargo/src/cargo/core/compiler/compile_kind.rs
1718
+++ b/src/tools/cargo/src/cargo/core/compiler/compile_kind.rs
1819
@@ -71,7 +71,13 @@ impl CompileKind {
1920
}
20-
21-
let kinds = match &config.build_config()?.target {
21+
22+
let kinds = match &gctx.build_config()?.target {
2223
- None => Ok(vec![CompileKind::Host]),
2324
+ None => {
2425
+ if let Ok(sb2_tgt) = std::env::var("SB2_RUST_TARGET_TRIPLE") {
2526
+ Ok(vec![CompileKind::Target(CompileTarget::new(&sb2_tgt)?)])
2627
+ } else {
2728
+ Ok(vec![CompileKind::Host])
2829
+ }
29-
+ }
30-
Some(build_target_config) => dedup(&build_target_config.values(config)?),
30+
+ },
31+
Some(build_target_config) => dedup(&build_target_config.values(gctx)?),
3132
};
32-
33-
--
34-
2.42.0
33+
34+
--
35+
2.45.2
3536

0 commit comments

Comments
 (0)