Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rust 1.75.0 #22

Merged
merged 3 commits into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 13 additions & 10 deletions 0001-Set-proper-llvm-targets.patch
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,22 @@ Subject: [PATCH] Set proper llvm targets.
Signed-off-by: Matti Kosola <matti.kosola@jolla.com>
Signed-off-by: Ruben De Smet <ruben.de.smet@rubdos.be>
---
config.toml.example | 2 +-
config.example.toml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

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

# LLVM experimental targets to build support for. These targets are specified in
# the same format as above, but since these targets are experimental, they are
--
2.43.0

26 changes: 17 additions & 9 deletions 0002-Disable-statx-for-all-builds.-JB-50106.patch
Original file line number Diff line number Diff line change
Expand Up @@ -16,38 +16,43 @@ Signed-off-by: Tomi Leppänen <tomi.leppanen@jolla.com
Signed-off-by: Matti Kosola <matti.kosola@jolla.com>
Signed-off-by: Ruben De Smet <ruben.de.smet@rubdos.be>
---
library/std/src/sys/unix/fs.rs | 27 ++-------------------------
1 file changed, 2 insertions(+), 25 deletions(-)
library/std/src/sys/unix/fs.rs | 32 ++------------------------------
1 file changed, 2 insertions(+), 30 deletions(-)

diff --git a/library/std/src/sys/unix/fs.rs b/library/std/src/sys/unix/fs.rs
index 7181451de575fcb8ff7df27ba5a66b18a08904be..141e1726db49f1ac483a5788bdbc31388a1c942e 100644
index 40eb910fdc3..8798aa7061c 100644
--- a/library/std/src/sys/unix/fs.rs
+++ b/library/std/src/sys/unix/fs.rs
@@ -13,23 +13,11 @@
@@ -17,28 +17,11 @@
use crate::sys::{cvt, cvt_r};
use crate::sys_common::{AsInner, AsInnerMut, FromInner, IntoInner};

-#[cfg(any(
- all(target_os = "linux", target_env = "gnu"),
- target_os = "macos",
- target_os = "ios",
- target_os = "tvos",
- target_os = "watchos",
-))]
-use crate::sys::weak::syscall;
#[cfg(target_os = "macos")]
#[cfg(any(target_os = "android", target_os = "macos", target_os = "solaris"))]
use crate::sys::weak::weak;

use libc::{c_int, mode_t};

-#[cfg(any(
- target_os = "macos",
- target_os = "ios",
- target_os = "tvos",
- target_os = "watchos",
- target_os = "solaris",
- all(target_os = "linux", target_env = "gnu")
-))]
-use libc::c_char;
#[cfg(any(target_os = "linux", target_os = "emscripten", target_os = "android"))]
use libc::dirfd;
#[cfg(any(target_os = "linux", target_os = "emscripten"))]
@@ -85,20 +73,9 @@
#[cfg(any(
all(target_os = "linux", not(target_env = "musl")),
target_os = "emscripten",
@@ -117,20 +100,9 @@
// https://github.com/rust-lang/rust/pull/67774
macro_rules! cfg_has_statx {
({ $($then_tt:tt)* } else { $($else_tt:tt)* }) => {
Expand All @@ -70,3 +75,6 @@ index 7181451de575fcb8ff7df27ba5a66b18a08904be..141e1726db49f1ac483a5788bdbc3138
}

cfg_has_statx! {{
--
2.43.0

Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ Signed-off-by: Ruben De Smet <ruben.de.smet@rubdos.be>
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs
index 4182a5d07118e0652ff63c4bec28bde0775d0c59..9904ab2e70d7aafab4ec63e86d0cdb383ca2285b 100644
index f745bc390ca..934f16ab4ab 100644
--- a/compiler/rustc_session/src/config.rs
+++ b/compiler/rustc_session/src/config.rs
@@ -1848,7 +1848,14 @@ pub fn parse_target_triple(
@@ -2241,7 +2241,14 @@ pub fn parse_target_triple(
})
}
Some(target) => TargetTriple::TargetTriple(target),
Expand All @@ -34,3 +34,6 @@ index 4182a5d07118e0652ff63c4bec28bde0775d0c59..9904ab2e70d7aafab4ec63e86d0cdb38
}
}

--
2.43.0

10 changes: 7 additions & 3 deletions 0004-Force-the-target-when-building-for-CompileKind-Host.patch
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,19 @@ Signed-off-by: Ruben De Smet <ruben.de.smet@rubdos.be>
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/tools/cargo/src/cargo/core/compiler/mod.rs b/src/tools/cargo/src/cargo/core/compiler/mod.rs
index 7024a2ac5..ebce975a9 100644
--- a/src/tools/cargo/src/cargo/core/compiler/mod.rs
+++ b/src/tools/cargo/src/cargo/core/compiler/mod.rs
@@ -989,6 +989,9 @@ fn build_base_args(

@@ -1111,6 +1111,9 @@ fn build_base_args(cx: &Context<'_, '_>, cmd: &mut ProcessBuilder, unit: &Unit)
if let CompileKind::Target(n) = unit.kind {
cmd.arg("--target").arg(n.rustc_target());
+ } else {
+ debug!("kind is {:?} - Forcing this to be 686", unit.kind);
+ cmd.arg("--target").arg("i686-unknown-linux-gnu");
}

opt(
--
2.42.0

86 changes: 46 additions & 40 deletions 0005-Provide-ENV-controls-to-bypass-some-sb2-calls-betwee.patch
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,19 @@ and the fallback fork/exec is used.
Note that some reworking of rust's handling of program/argv[0] was
needed to support the SHIM functionality

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

diff --git a/library/std/src/sys/unix/process/process_common.rs b/library/std/src/sys/unix/process/process_common.rs
index 27bee714f5b4317132db508fe916c7e194d05bc5..7746177e0423b7689833cc84b6132240a8bb2bf0 100644
index bac32d9e60e..3cd9767da88 100644
--- a/library/std/src/sys/unix/process/process_common.rs
+++ b/library/std/src/sys/unix/process/process_common.rs
@@ -61,7 +61,7 @@ cfg_if::cfg_if! {
@@ -85,7 +85,7 @@ pub unsafe fn sigaddset(set: *mut libc::sigset_t, signum: libc::c_int) -> libc::
////////////////////////////////////////////////////////////////////////////////

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

program_kind: ProgramKind,
cwd: Option<CString>,
uid: Option<uid_t>,
@@ -85,6 +92,14 @@ pub struct Command {
@@ -110,6 +117,14 @@ pub struct Command {
pgroup: Option<pid_t>,
}

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

@@ -132,15 +147,23 @@ impl Command {
pub fn new(program: &OsStr) -> Command {
@@ -183,16 +198,24 @@ pub fn new(program: &OsStr) -> Command {
let mut saw_nul = false;
let program_kind = ProgramKind::new(program.as_ref());
let program = os2c(program, &mut saw_nul);
+ let arg0 = program.clone();
Command {
- argv: Argv(vec![program.as_ptr(), ptr::null()]),
- args: vec![program.clone()],
- program,
+ argv: Argv(vec![arg0.as_ptr(), ptr::null()]),
+ args: vec![arg0],
+ program: program,
program,
program_kind,
env: Default::default(),
+ execvp: None,
+ dup2: None,
Expand All @@ -109,18 +110,18 @@ index 27bee714f5b4317132db508fe916c7e194d05bc5..7746177e0423b7689833cc84b6132240
closures: Vec::new(),
groups: None,
stdin: None,
@@ -154,15 +177,23 @@ impl Command {
pub fn new(program: &OsStr) -> Command {
@@ -207,16 +230,24 @@ pub fn new(program: &OsStr) -> Command {
let mut saw_nul = false;
let program_kind = ProgramKind::new(program.as_ref());
let program = os2c(program, &mut saw_nul);
+ let arg0 = program.clone();
Command {
- argv: Argv(vec![program.as_ptr(), ptr::null()]),
- args: vec![program.clone()],
- program,
+ argv: Argv(vec![arg0.as_ptr(), ptr::null()]),
+ args: vec![arg0],
+ program: program,
program,
program_kind,
env: Default::default(),
+ execvp: None,
+ dup2: None,
Expand All @@ -137,7 +138,7 @@ index 27bee714f5b4317132db508fe916c7e194d05bc5..7746177e0423b7689833cc84b6132240
closures: Vec::new(),
groups: None,
stdin: None,
@@ -173,6 +204,16 @@ impl Command {
@@ -227,6 +258,16 @@ pub fn new(program: &OsStr) -> Command {
}
}

Expand All @@ -155,18 +156,21 @@ index 27bee714f5b4317132db508fe916c7e194d05bc5..7746177e0423b7689833cc84b6132240
// Set a new arg0
let arg = os2c(arg, &mut self.saw_nul);
diff --git a/library/std/src/sys/unix/process/process_unix.rs b/library/std/src/sys/unix/process/process_unix.rs
index 3d305cd7310fd4b8419d220d1adeadebb9fda914..5d1c667b943cb2af0e0e918c17a7b24293617376 100644
index 72aca4e6659..495368b58ec 100644
--- a/library/std/src/sys/unix/process/process_unix.rs
+++ b/library/std/src/sys/unix/process/process_unix.rs
@@ -27,11 +27,15 @@
@@ -25,7 +25,7 @@
use libc::RTP_ID as pid_t;

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

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

+use crate::ffi::OsString;
+use crate::intrinsics::transmute;
Expand All @@ -175,8 +179,8 @@ index 3d305cd7310fd4b8419d220d1adeadebb9fda914..5d1c667b943cb2af0e0e918c17a7b242
////////////////////////////////////////////////////////////////////////////////
// Command
////////////////////////////////////////////////////////////////////////////////
@@ -61,6 +65,65 @@ pub fn spawn(

@@ -95,6 +99,65 @@ pub fn spawn(
#[cfg(not(target_os = "linux"))]
let (input, output) = sys::pipe::anon_pipe()?;

+ // If there is a RUST_EXEC_SHIM (could be "/usr/bin/env --")
Expand Down Expand Up @@ -241,22 +245,21 @@ index 3d305cd7310fd4b8419d220d1adeadebb9fda914..5d1c667b943cb2af0e0e918c17a7b242
// Whatever happens after the fork is almost for sure going to touch or
// look at the environment in one way or another (PATH in `execvp` or
// accessing the `environ` pointer ourselves). Make sure no other thread
@@ -76,7 +139,7 @@ pub fn spawn(
@@ -111,7 +174,7 @@ pub fn spawn(
if pid == 0 {
crate::panic::always_abort();
mem::forget(env_lock);
mem::forget(env_lock); // avoid non-async-signal-safe unlocking
- drop(input);
+ self.unwrap_drop(input);
let Err(err) = unsafe { self.do_exec(theirs, envp.as_ref()) };
let errno = err.raw_os_error().unwrap_or(libc::EINVAL) as u32;
let errno = errno.to_be_bytes();
@@ -243,7 +306,48 @@ pub fn exec(&mut self, default: Stdio) -> io::Error {
#[cfg(target_os = "linux")]
if self.get_create_pidfd() {
self.send_pidfd(&output);
@@ -268,7 +331,47 @@ pub fn exec(&mut self, default: Stdio) -> io::Error {
Err(e) => e,
}
}
-
+ fn unwrap_drop(&mut self, fh: sys::unix::pipe::AnonPipe) {
+ use crate::os::unix::io::AsRawFd;
+ fn unwrap_drop(&mut self, fh: impl crate::os::unix::io::AsRawFd) {
+ // drop() simply calls libc::close(fh.fd)
+ match self.close {
+ Some(real_close) => {
Expand Down Expand Up @@ -300,7 +303,7 @@ index 3d305cd7310fd4b8419d220d1adeadebb9fda914..5d1c667b943cb2af0e0e918c17a7b242
// And at this point we've reached a special time in the life of the
// child. The child must now be considered hamstrung and unable to
// do anything other than syscalls really. Consider the following
@@ -282,13 +386,13 @@ unsafe fn do_exec(
@@ -308,13 +411,13 @@ unsafe fn do_exec(
use crate::sys::{self, cvt_r};

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

#[cfg(not(target_os = "l4re"))]
@@ -296,10 +400,10 @@ unsafe fn do_exec(
@@ -322,10 +425,10 @@ unsafe fn do_exec(
if let Some(_g) = self.get_groups() {
//FIXME: Redox kernel does not support setgroups yet
#[cfg(not(target_os = "redox"))]
Expand All @@ -330,12 +333,12 @@ index 3d305cd7310fd4b8419d220d1adeadebb9fda914..5d1c667b943cb2af0e0e918c17a7b242
}
if let Some(u) = self.get_uid() {
// When dropping privileges from root, the `setgroups` call
@@ -311,13 +415,13 @@ unsafe fn do_exec(
@@ -337,13 +440,13 @@ unsafe fn do_exec(
//FIXME: Redox kernel does not support setgroups yet
#[cfg(not(target_os = "redox"))]
if libc::getuid() == 0 && self.get_groups().is_none() {
- cvt(libc::setgroups(0, ptr::null()))?;
+ cvt(self.unwrap_setgroups(0, ptr::null()))?;
- cvt(libc::setgroups(0, crate::ptr::null()))?;
+ cvt(self.unwrap_setgroups(0, crate::ptr::null()))?;
}
- cvt(libc::setuid(u as uid_t))?;
+ cvt(self.unwrap_setuid(u as uid_t))?;
Expand All @@ -347,7 +350,7 @@ index 3d305cd7310fd4b8419d220d1adeadebb9fda914..5d1c667b943cb2af0e0e918c17a7b242
}

if let Some(pgroup) = self.get_pgroup() {
@@ -378,8 +482,12 @@ fn drop(&mut self) {
@@ -408,8 +511,12 @@ fn drop(&mut self) {
_reset = Some(Reset(*sys::os::environ()));
*sys::os::environ() = envp.as_ptr();
}
Expand All @@ -362,17 +365,17 @@ index 3d305cd7310fd4b8419d220d1adeadebb9fda914..5d1c667b943cb2af0e0e918c17a7b242
Err(io::Error::last_os_error())
}

@@ -394,6 +502,7 @@ fn posix_spawn(
@@ -436,6 +543,7 @@ fn posix_spawn(
_: &ChildPipes,
_: Option<&CStringArray>,
) -> io::Result<Option<Process>> {
+ eprintln!("process_unix:270: in null posix_spawn");
Ok(None)
}

@@ -413,12 +522,15 @@ fn posix_spawn(
@@ -459,12 +567,15 @@ fn posix_spawn(
use crate::mem::MaybeUninit;
use crate::sys::{self, cvt_nz};
use crate::sys::{self, cvt_nz, unix_sigpipe_attr_specified};

+ let skip_spawnvp: bool = getenv(&OsString::from("SB2_RUST_NO_SPAWNVP")).is_some();
+
Expand All @@ -386,3 +389,6 @@ index 3d305cd7310fd4b8419d220d1adeadebb9fda914..5d1c667b943cb2af0e0e918c17a7b242
{
return Ok(None);
}
--
2.43.0