Skip to content

Commit 8b93fea

Browse files
authored
Merge pull request #22 from rubdos/1.75.0
Rust 1.75.0
2 parents 27eecc6 + b7fe716 commit 8b93fea

15 files changed

+418
-87
lines changed

0001-Set-proper-llvm-targets.patch

+13-10
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,22 @@ Subject: [PATCH] Set proper llvm targets.
66
Signed-off-by: Matti Kosola <matti.kosola@jolla.com>
77
Signed-off-by: Ruben De Smet <ruben.de.smet@rubdos.be>
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 e5df28a49af..48a9fafea6f 100644
14+
--- a/config.example.toml
15+
+++ b/config.example.toml
16+
@@ -99,7 +99,7 @@ change-id = 116881
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
2424
# the same format as above, but since these targets are experimental, they are
25+
--
26+
2.43.0
27+

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

+17-9
Original file line numberDiff line numberDiff line change
@@ -16,38 +16,43 @@ Signed-off-by: Tomi Leppänen <tomi.leppanen@jolla.com
1616
Signed-off-by: Matti Kosola <matti.kosola@jolla.com>
1717
Signed-off-by: Ruben De Smet <ruben.de.smet@rubdos.be>
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 40eb910fdc3..8798aa7061c 100644
2424
--- a/library/std/src/sys/unix/fs.rs
2525
+++ b/library/std/src/sys/unix/fs.rs
26-
@@ -13,23 +13,11 @@
26+
@@ -17,28 +17,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",
35+
- target_os = "watchos",
3436
-))]
3537
-use crate::sys::weak::syscall;
36-
#[cfg(target_os = "macos")]
38+
#[cfg(any(target_os = "android", target_os = "macos", target_os = "solaris"))]
3739
use crate::sys::weak::weak;
3840

3941
use libc::{c_int, mode_t};
4042

4143
-#[cfg(any(
4244
- target_os = "macos",
4345
- target_os = "ios",
46+
- target_os = "tvos",
47+
- target_os = "watchos",
48+
- target_os = "solaris",
4449
- all(target_os = "linux", target_env = "gnu")
4550
-))]
4651
-use libc::c_char;
47-
#[cfg(any(target_os = "linux", target_os = "emscripten", target_os = "android"))]
48-
use libc::dirfd;
49-
#[cfg(any(target_os = "linux", target_os = "emscripten"))]
50-
@@ -85,20 +73,9 @@
52+
#[cfg(any(
53+
all(target_os = "linux", not(target_env = "musl")),
54+
target_os = "emscripten",
55+
@@ -117,20 +100,9 @@
5156
// https://github.com/rust-lang/rust/pull/67774
5257
macro_rules! cfg_has_statx {
5358
({ $($then_tt:tt)* } else { $($else_tt:tt)* }) => {
@@ -70,3 +75,6 @@ index 7181451de575fcb8ff7df27ba5a66b18a08904be..141e1726db49f1ac483a5788bdbc3138
7075
}
7176

7277
cfg_has_statx! {{
78+
--
79+
2.43.0
80+

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

+5-2
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ Signed-off-by: Ruben De Smet <ruben.de.smet@rubdos.be>
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 f745bc390ca..934f16ab4ab 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+
@@ -2241,7 +2241,14 @@ pub fn parse_target_triple(
2222
})
2323
}
2424
Some(target) => TargetTriple::TargetTriple(target),
@@ -34,3 +34,6 @@ index 4182a5d07118e0652ff63c4bec28bde0775d0c59..9904ab2e70d7aafab4ec63e86d0cdb38
3434
}
3535
}
3636

37+
--
38+
2.43.0
39+

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

+7-3
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,19 @@ Signed-off-by: Ruben De Smet <ruben.de.smet@rubdos.be>
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 7024a2ac5..ebce975a9 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(
28+
--
29+
2.42.0
30+

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

+46-40
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,19 @@ and the fallback fork/exec is used.
3232
Note that some reworking of rust's handling of program/argv[0] was
3333
needed to support the SHIM functionality
3434

35+
Co-authored-by: Ruben De Smet <ruben.de.smet@rubdos.be>
3536
Signed-off-by: David Greaves <david.greaves@jolla.com>
3637
Signed-off-by: Ruben De Smet <ruben.de.smet@rubdos.be>
3738
---
38-
.../src/sys/unix/process/process_common.rs | 50 ++++++-
39-
.../std/src/sys/unix/process/process_unix.rs | 138 ++++++++++++++++--
40-
2 files changed, 170 insertions(+), 18 deletions(-)
39+
.../src/sys/unix/process/process_common.rs | 55 ++++++-
40+
.../std/src/sys/unix/process/process_unix.rs | 137 ++++++++++++++++--
41+
2 files changed, 172 insertions(+), 20 deletions(-)
4142

4243
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
44+
index bac32d9e60e..3cd9767da88 100644
4445
--- a/library/std/src/sys/unix/process/process_common.rs
4546
+++ b/library/std/src/sys/unix/process/process_common.rs
46-
@@ -61,7 +61,7 @@ cfg_if::cfg_if! {
47+
@@ -85,7 +85,7 @@ pub unsafe fn sigaddset(set: *mut libc::sigset_t, signum: libc::c_int) -> libc::
4748
////////////////////////////////////////////////////////////////////////////////
4849

4950
pub struct Command {
@@ -52,7 +53,7 @@ index 27bee714f5b4317132db508fe916c7e194d05bc5..7746177e0423b7689833cc84b6132240
5253
args: Vec<CString>,
5354
/// Exactly what will be passed to `execvp`.
5455
///
55-
@@ -70,6 +70,13 @@ pub struct Command {
56+
@@ -94,6 +94,13 @@ pub struct Command {
5657
/// `args` to properly update this as well.
5758
argv: Argv,
5859
env: CommandEnv,
@@ -64,9 +65,9 @@ index 27bee714f5b4317132db508fe916c7e194d05bc5..7746177e0423b7689833cc84b6132240
6465
+ pub(crate) setgid: Option<SetgidFn>,
6566
+ pub(crate) setgroups: Option<SetgroupsFn>,
6667

68+
program_kind: ProgramKind,
6769
cwd: Option<CString>,
68-
uid: Option<uid_t>,
69-
@@ -85,6 +92,14 @@ pub struct Command {
70+
@@ -110,6 +117,14 @@ pub struct Command {
7071
pgroup: Option<pid_t>,
7172
}
7273

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

84-
@@ -132,15 +147,23 @@ impl Command {
85-
pub fn new(program: &OsStr) -> Command {
85+
@@ -183,16 +198,24 @@ pub fn new(program: &OsStr) -> Command {
8686
let mut saw_nul = false;
87+
let program_kind = ProgramKind::new(program.as_ref());
8788
let program = os2c(program, &mut saw_nul);
8889
+ let arg0 = program.clone();
8990
Command {
9091
- argv: Argv(vec![program.as_ptr(), ptr::null()]),
9192
- args: vec![program.clone()],
92-
- program,
9393
+ argv: Argv(vec![arg0.as_ptr(), ptr::null()]),
9494
+ args: vec![arg0],
95-
+ program: program,
95+
program,
96+
program_kind,
9697
env: Default::default(),
9798
+ execvp: None,
9899
+ dup2: None,
@@ -109,18 +110,18 @@ index 27bee714f5b4317132db508fe916c7e194d05bc5..7746177e0423b7689833cc84b6132240
109110
closures: Vec::new(),
110111
groups: None,
111112
stdin: None,
112-
@@ -154,15 +177,23 @@ impl Command {
113-
pub fn new(program: &OsStr) -> Command {
113+
@@ -207,16 +230,24 @@ pub fn new(program: &OsStr) -> Command {
114114
let mut saw_nul = false;
115+
let program_kind = ProgramKind::new(program.as_ref());
115116
let program = os2c(program, &mut saw_nul);
116117
+ let arg0 = program.clone();
117118
Command {
118119
- argv: Argv(vec![program.as_ptr(), ptr::null()]),
119120
- args: vec![program.clone()],
120-
- program,
121121
+ argv: Argv(vec![arg0.as_ptr(), ptr::null()]),
122122
+ args: vec![arg0],
123-
+ program: program,
123+
program,
124+
program_kind,
124125
env: Default::default(),
125126
+ execvp: None,
126127
+ dup2: None,
@@ -137,7 +138,7 @@ index 27bee714f5b4317132db508fe916c7e194d05bc5..7746177e0423b7689833cc84b6132240
137138
closures: Vec::new(),
138139
groups: None,
139140
stdin: None,
140-
@@ -173,6 +204,16 @@ impl Command {
141+
@@ -227,6 +258,16 @@ pub fn new(program: &OsStr) -> Command {
141142
}
142143
}
143144

@@ -155,18 +156,21 @@ index 27bee714f5b4317132db508fe916c7e194d05bc5..7746177e0423b7689833cc84b6132240
155156
// Set a new arg0
156157
let arg = os2c(arg, &mut self.saw_nul);
157158
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
159+
index 72aca4e6659..495368b58ec 100644
159160
--- a/library/std/src/sys/unix/process/process_unix.rs
160161
+++ b/library/std/src/sys/unix/process/process_unix.rs
161-
@@ -27,11 +27,15 @@
162+
@@ -25,7 +25,7 @@
162163
use libc::RTP_ID as pid_t;
163164

164165
#[cfg(not(target_os = "vxworks"))]
165166
-use libc::{c_int, pid_t};
166167
+use libc::{c_char, c_int, dlsym, pid_t};
167168

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

171175
+use crate::ffi::OsString;
172176
+use crate::intrinsics::transmute;
@@ -175,8 +179,8 @@ index 3d305cd7310fd4b8419d220d1adeadebb9fda914..5d1c667b943cb2af0e0e918c17a7b242
175179
////////////////////////////////////////////////////////////////////////////////
176180
// Command
177181
////////////////////////////////////////////////////////////////////////////////
178-
@@ -61,6 +65,65 @@ pub fn spawn(
179-
182+
@@ -95,6 +99,65 @@ pub fn spawn(
183+
#[cfg(not(target_os = "linux"))]
180184
let (input, output) = sys::pipe::anon_pipe()?;
181185

182186
+ // If there is a RUST_EXEC_SHIM (could be "/usr/bin/env --")
@@ -241,22 +245,21 @@ index 3d305cd7310fd4b8419d220d1adeadebb9fda914..5d1c667b943cb2af0e0e918c17a7b242
241245
// Whatever happens after the fork is almost for sure going to touch or
242246
// look at the environment in one way or another (PATH in `execvp` or
243247
// accessing the `environ` pointer ourselves). Make sure no other thread
244-
@@ -76,7 +139,7 @@ pub fn spawn(
248+
@@ -111,7 +174,7 @@ pub fn spawn(
245249
if pid == 0 {
246250
crate::panic::always_abort();
247-
mem::forget(env_lock);
251+
mem::forget(env_lock); // avoid non-async-signal-safe unlocking
248252
- drop(input);
249253
+ self.unwrap_drop(input);
250-
let Err(err) = unsafe { self.do_exec(theirs, envp.as_ref()) };
251-
let errno = err.raw_os_error().unwrap_or(libc::EINVAL) as u32;
252-
let errno = errno.to_be_bytes();
253-
@@ -243,7 +306,48 @@ pub fn exec(&mut self, default: Stdio) -> io::Error {
254+
#[cfg(target_os = "linux")]
255+
if self.get_create_pidfd() {
256+
self.send_pidfd(&output);
257+
@@ -268,7 +331,47 @@ pub fn exec(&mut self, default: Stdio) -> io::Error {
254258
Err(e) => e,
255259
}
256260
}
257261
-
258-
+ fn unwrap_drop(&mut self, fh: sys::unix::pipe::AnonPipe) {
259-
+ use crate::os::unix::io::AsRawFd;
262+
+ fn unwrap_drop(&mut self, fh: impl crate::os::unix::io::AsRawFd) {
260263
+ // drop() simply calls libc::close(fh.fd)
261264
+ match self.close {
262265
+ Some(real_close) => {
@@ -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+
@@ -308,13 +411,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+
@@ -322,10 +425,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+
@@ -337,13 +440,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+
@@ -408,8 +511,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+
@@ -436,6 +543,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+
@@ -459,12 +567,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
+
@@ -386,3 +389,6 @@ index 3d305cd7310fd4b8419d220d1adeadebb9fda914..5d1c667b943cb2af0e0e918c17a7b242
386389
{
387390
return Ok(None);
388391
}
392+
--
393+
2.43.0
394+

0 commit comments

Comments
 (0)