diff --git a/0001-Set-proper-llvm-targets.patch b/0001-Set-proper-llvm-targets.patch index d3ad25f..15eb2e4 100644 --- a/0001-Set-proper-llvm-targets.patch +++ b/0001-Set-proper-llvm-targets.patch @@ -6,19 +6,22 @@ Subject: [PATCH] Set proper llvm targets. Signed-off-by: Matti Kosola Signed-off-by: Ruben De Smet --- - 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 + diff --git a/0002-Disable-statx-for-all-builds.-JB-50106.patch b/0002-Disable-statx-for-all-builds.-JB-50106.patch index cd242fb..cb2de22 100644 --- a/0002-Disable-statx-for-all-builds.-JB-50106.patch +++ b/0002-Disable-statx-for-all-builds.-JB-50106.patch @@ -16,14 +16,14 @@ Signed-off-by: Tomi Leppänen Signed-off-by: Ruben De Smet --- - 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}; @@ -31,9 +31,11 @@ index 7181451de575fcb8ff7df27ba5a66b18a08904be..141e1726db49f1ac483a5788bdbc3138 - 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}; @@ -41,13 +43,16 @@ index 7181451de575fcb8ff7df27ba5a66b18a08904be..141e1726db49f1ac483a5788bdbc3138 -#[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)* }) => { @@ -70,3 +75,6 @@ index 7181451de575fcb8ff7df27ba5a66b18a08904be..141e1726db49f1ac483a5788bdbc3138 } cfg_has_statx! {{ +-- +2.43.0 + diff --git a/0003-Scratchbox2-needs-to-be-able-to-tell-rustc-the-defau.patch b/0003-Scratchbox2-needs-to-be-able-to-tell-rustc-the-defau.patch index 5078eb5..54ba44a 100644 --- a/0003-Scratchbox2-needs-to-be-able-to-tell-rustc-the-defau.patch +++ b/0003-Scratchbox2-needs-to-be-able-to-tell-rustc-the-defau.patch @@ -15,10 +15,10 @@ Signed-off-by: Ruben De Smet 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), @@ -34,3 +34,6 @@ index 4182a5d07118e0652ff63c4bec28bde0775d0c59..9904ab2e70d7aafab4ec63e86d0cdb38 } } +-- +2.43.0 + diff --git a/0004-Force-the-target-when-building-for-CompileKind-Host.patch b/0004-Force-the-target-when-building-for-CompileKind-Host.patch index b0f395a..ada72ff 100644 --- a/0004-Force-the-target-when-building-for-CompileKind-Host.patch +++ b/0004-Force-the-target-when-building-for-CompileKind-Host.patch @@ -12,15 +12,19 @@ Signed-off-by: Ruben De Smet 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 + diff --git a/0005-Provide-ENV-controls-to-bypass-some-sb2-calls-betwee.patch b/0005-Provide-ENV-controls-to-bypass-some-sb2-calls-betwee.patch index 45c0404..128cab3 100644 --- a/0005-Provide-ENV-controls-to-bypass-some-sb2-calls-betwee.patch +++ b/0005-Provide-ENV-controls-to-bypass-some-sb2-calls-betwee.patch @@ -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 Signed-off-by: David Greaves Signed-off-by: Ruben De Smet --- - .../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 { @@ -52,7 +53,7 @@ index 27bee714f5b4317132db508fe916c7e194d05bc5..7746177e0423b7689833cc84b6132240 args: Vec, /// 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, @@ -64,9 +65,9 @@ index 27bee714f5b4317132db508fe916c7e194d05bc5..7746177e0423b7689833cc84b6132240 + pub(crate) setgid: Option, + pub(crate) setgroups: Option, + program_kind: ProgramKind, cwd: Option, - uid: Option, -@@ -85,6 +92,14 @@ pub struct Command { +@@ -110,6 +117,14 @@ pub struct Command { pgroup: Option, } @@ -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, @@ -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, @@ -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 { } } @@ -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; @@ -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 --") @@ -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) => { @@ -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() { @@ -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"))] @@ -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))?; @@ -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(); } @@ -362,7 +365,7 @@ 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> { @@ -370,9 +373,9 @@ index 3d305cd7310fd4b8419d220d1adeadebb9fda914..5d1c667b943cb2af0e0e918c17a7b242 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(); + @@ -386,3 +389,6 @@ index 3d305cd7310fd4b8419d220d1adeadebb9fda914..5d1c667b943cb2af0e0e918c17a7b242 { return Ok(None); } +-- +2.43.0 + diff --git a/0006-Scratchbox2-needs-to-be-able-to-tell-cargo-the-defau.patch b/0006-Scratchbox2-needs-to-be-able-to-tell-cargo-the-defau.patch index 0c755a5..b99845e 100644 --- a/0006-Scratchbox2-needs-to-be-able-to-tell-cargo-the-defau.patch +++ b/0006-Scratchbox2-needs-to-be-able-to-tell-cargo-the-defau.patch @@ -12,12 +12,12 @@ Signed-off-by: Ruben De Smet 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/cargo/src/cargo/core/compiler/compile_kind.rs b/src/tools/cargo/src/cargo/core/compiler/compile_kind.rs -index c3c921d41..d8a08582a 100644 +index 73d8f89cc..5d17c15d2 100644 --- a/src/tools/cargo/src/cargo/core/compiler/compile_kind.rs +++ b/src/tools/cargo/src/cargo/core/compiler/compile_kind.rs -@@ -72,7 +72,13 @@ impl CompileKind { +@@ -71,7 +71,13 @@ impl CompileKind { } - + let kinds = match &config.build_config()?.target { - None => Ok(vec![CompileKind::Host]), + None => { @@ -26,6 +26,10 @@ index c3c921d41..d8a08582a 100644 + } else { + Ok(vec![CompileKind::Host]) + } -+ }, ++ } Some(build_target_config) => dedup(&build_target_config.values(config)?), }; + +-- +2.42.0 + diff --git a/0007-Disable-aarch64-outline-atomics-for-now.patch b/0007-Disable-aarch64-outline-atomics-for-now.patch index 7a0309d..bf5d1b0 100644 --- a/0007-Disable-aarch64-outline-atomics-for-now.patch +++ b/0007-Disable-aarch64-outline-atomics-for-now.patch @@ -10,18 +10,22 @@ The feature causes linking problems. Signed-off-by: Matti Lehtimäki --- - compiler/rustc_target/src/spec/aarch64_unknown_linux_gnu.rs | 1 - - 1 file changed, 1 deletion(-) + .../rustc_target/src/spec/targets/aarch64_unknown_linux_gnu.rs | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) -diff --git a/compiler/rustc_target/src/spec/aarch64_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/aarch64_unknown_linux_gnu.rs -index 3006044d5..6ef7b596e 100644 ---- a/compiler/rustc_target/src/spec/aarch64_unknown_linux_gnu.rs -+++ b/compiler/rustc_target/src/spec/aarch64_unknown_linux_gnu.rs -@@ -7,7 +7,6 @@ pub fn target() -> Target { +diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu.rs +index c0b07db3818..b8f240295be 100644 +--- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu.rs ++++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu.rs +@@ -7,7 +7,7 @@ pub fn target() -> Target { data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(), arch: "aarch64".into(), options: TargetOptions { -- features: "+outline-atomics".into(), +- features: "+v8a,+outline-atomics".into(), ++ features: "+v8a".into(), mcount: "\u{1}_mcount".into(), max_atomic_width: Some(128), supported_sanitizers: SanitizerSet::ADDRESS +-- +2.43.0 + diff --git a/0008-Revert-Use-statx-s-64-bit-times-on-32-bit-linux-gnu.patch b/0008-Revert-Use-statx-s-64-bit-times-on-32-bit-linux-gnu.patch new file mode 100644 index 0000000..2b143b2 --- /dev/null +++ b/0008-Revert-Use-statx-s-64-bit-times-on-32-bit-linux-gnu.patch @@ -0,0 +1,256 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Ruben De Smet +Date: Mon, 23 Oct 2023 20:39:13 +0200 +Subject: [PATCH] Revert "Use statx's 64-bit times on 32-bit linux-gnu" + +Additionally adds a `dead_code` lint supression on SystemTime::new. + +This reverts commit fec4818fdb40c82679f57fa7f26fcddc1a874c13. +--- + library/std/src/os/linux/fs.rs | 21 +----- + library/std/src/sys/unix/fs.rs | 109 +++++++++++-------------------- + library/std/src/sys/unix/time.rs | 1 + + 3 files changed, 42 insertions(+), 89 deletions(-) + +diff --git a/library/std/src/os/linux/fs.rs b/library/std/src/os/linux/fs.rs +index ab0b2a3eda3..4ac9ae4fd04 100644 +--- a/library/std/src/os/linux/fs.rs ++++ b/library/std/src/os/linux/fs.rs +@@ -363,34 +363,19 @@ fn st_size(&self) -> u64 { + self.as_inner().as_inner().st_size as u64 + } + fn st_atime(&self) -> i64 { +- let file_attr = self.as_inner(); +- #[cfg(all(target_env = "gnu", target_pointer_width = "32"))] +- if let Some(atime) = file_attr.stx_atime() { +- return atime.tv_sec; +- } +- file_attr.as_inner().st_atime as i64 ++ self.as_inner().as_inner().st_atime as i64 + } + fn st_atime_nsec(&self) -> i64 { + self.as_inner().as_inner().st_atime_nsec as i64 + } + fn st_mtime(&self) -> i64 { +- let file_attr = self.as_inner(); +- #[cfg(all(target_env = "gnu", target_pointer_width = "32"))] +- if let Some(mtime) = file_attr.stx_mtime() { +- return mtime.tv_sec; +- } +- file_attr.as_inner().st_mtime as i64 ++ self.as_inner().as_inner().st_mtime as i64 + } + fn st_mtime_nsec(&self) -> i64 { + self.as_inner().as_inner().st_mtime_nsec as i64 + } + fn st_ctime(&self) -> i64 { +- let file_attr = self.as_inner(); +- #[cfg(all(target_env = "gnu", target_pointer_width = "32"))] +- if let Some(ctime) = file_attr.stx_ctime() { +- return ctime.tv_sec; +- } +- file_attr.as_inner().st_ctime as i64 ++ self.as_inner().as_inner().st_ctime as i64 + } + fn st_ctime_nsec(&self) -> i64 { + self.as_inner().as_inner().st_ctime_nsec as i64 +diff --git a/library/std/src/sys/unix/fs.rs b/library/std/src/sys/unix/fs.rs +index 8798aa7061c..1d92664b2e1 100644 +--- a/library/std/src/sys/unix/fs.rs ++++ b/library/std/src/sys/unix/fs.rs +@@ -117,19 +117,10 @@ struct StatxExtraFields { + // This is needed to check if btime is supported by the filesystem. + stx_mask: u32, + stx_btime: libc::statx_timestamp, +- // With statx, we can overcome 32-bit `time_t` too. +- #[cfg(target_pointer_width = "32")] +- stx_atime: libc::statx_timestamp, +- #[cfg(target_pointer_width = "32")] +- stx_ctime: libc::statx_timestamp, +- #[cfg(target_pointer_width = "32")] +- stx_mtime: libc::statx_timestamp, +- + } + +- // We prefer `statx` on Linux if available, which contains file creation time, +- // as well as 64-bit timestamps of all kinds. +- // Default `stat64` contains no creation time and may have 32-bit `time_t`. ++ // We prefer `statx` on Linux if available, which contains file creation time. ++ // Default `stat64` contains no creation time. + unsafe fn try_statx( + fd: c_int, + path: *const c_char, +@@ -219,13 +210,6 @@ fn statx( + let extra = StatxExtraFields { + stx_mask: buf.stx_mask, + stx_btime: buf.stx_btime, +- // Store full times to avoid 32-bit `time_t` truncation. +- #[cfg(target_pointer_width = "32")] +- stx_atime: buf.stx_atime, +- #[cfg(target_pointer_width = "32")] +- stx_ctime: buf.stx_ctime, +- #[cfg(target_pointer_width = "32")] +- stx_mtime: buf.stx_mtime, + }; + + Some(Ok(FileAttr { stat, statx_extra_fields: Some(extra) })) +@@ -380,36 +364,6 @@ impl FileAttr { + fn from_stat64(stat: stat64) -> Self { + Self { stat, statx_extra_fields: None } + } +- +- #[cfg(target_pointer_width = "32")] +- pub fn stx_mtime(&self) -> Option<&libc::statx_timestamp> { +- if let Some(ext) = &self.statx_extra_fields { +- if (ext.stx_mask & libc::STATX_MTIME) != 0 { +- return Some(&ext.stx_mtime); +- } +- } +- None +- } +- +- #[cfg(target_pointer_width = "32")] +- pub fn stx_atime(&self) -> Option<&libc::statx_timestamp> { +- if let Some(ext) = &self.statx_extra_fields { +- if (ext.stx_mask & libc::STATX_ATIME) != 0 { +- return Some(&ext.stx_atime); +- } +- } +- None +- } +- +- #[cfg(target_pointer_width = "32")] +- pub fn stx_ctime(&self) -> Option<&libc::statx_timestamp> { +- if let Some(ext) = &self.statx_extra_fields { +- if (ext.stx_mask & libc::STATX_CTIME) != 0 { +- return Some(&ext.stx_ctime); +- } +- } +- None +- } + } + } else { + impl FileAttr { +@@ -435,15 +389,24 @@ pub fn file_type(&self) -> FileType { + #[cfg(target_os = "netbsd")] + impl FileAttr { + pub fn modified(&self) -> io::Result { +- Ok(SystemTime::new(self.stat.st_mtime as i64, self.stat.st_mtimensec as i64)) ++ Ok(SystemTime::from(libc::timespec { ++ tv_sec: self.stat.st_mtime as libc::time_t, ++ tv_nsec: self.stat.st_mtimensec as libc::c_long, ++ })) + } + + pub fn accessed(&self) -> io::Result { +- Ok(SystemTime::new(self.stat.st_atime as i64, self.stat.st_atimensec as i64)) ++ Ok(SystemTime::from(libc::timespec { ++ tv_sec: self.stat.st_atime as libc::time_t, ++ tv_nsec: self.stat.st_atimensec as libc::c_long, ++ })) + } + + pub fn created(&self) -> io::Result { +- Ok(SystemTime::new(self.stat.st_birthtime as i64, self.stat.st_birthtimensec as i64)) ++ Ok(SystemTime::from(libc::timespec { ++ tv_sec: self.stat.st_birthtime as libc::time_t, ++ tv_nsec: self.stat.st_birthtimensec as libc::c_long, ++ })) + } + } + +@@ -472,19 +435,18 @@ impl FileAttr { + target_os = "hurd", + )))] + pub fn modified(&self) -> io::Result { +- #[cfg(target_pointer_width = "32")] +- cfg_has_statx! { +- if let Some(mtime) = self.stx_mtime() { +- return Ok(SystemTime::new(mtime.tv_sec, mtime.tv_nsec as i64)); +- } +- } +- +- Ok(SystemTime::new(self.stat.st_mtime as i64, self.stat.st_mtime_nsec as i64)) ++ Ok(SystemTime::from(libc::timespec { ++ tv_sec: self.stat.st_mtime as libc::time_t, ++ tv_nsec: self.stat.st_mtime_nsec as _, ++ })) + } + + #[cfg(any(target_os = "vxworks", target_os = "espidf", target_os = "vita"))] + pub fn modified(&self) -> io::Result { +- Ok(SystemTime::new(self.stat.st_mtime as i64, 0)) ++ Ok(SystemTime::from(libc::timespec { ++ tv_sec: self.stat.st_mtime as libc::time_t, ++ tv_nsec: 0, ++ })) + } + + #[cfg(any(target_os = "horizon", target_os = "hurd"))] +@@ -500,19 +462,18 @@ pub fn modified(&self) -> io::Result { + target_os = "hurd", + )))] + pub fn accessed(&self) -> io::Result { +- #[cfg(target_pointer_width = "32")] +- cfg_has_statx! { +- if let Some(atime) = self.stx_atime() { +- return Ok(SystemTime::new(atime.tv_sec, atime.tv_nsec as i64)); +- } +- } +- +- Ok(SystemTime::new(self.stat.st_atime as i64, self.stat.st_atime_nsec as i64)) ++ Ok(SystemTime::from(libc::timespec { ++ tv_sec: self.stat.st_atime as libc::time_t, ++ tv_nsec: self.stat.st_atime_nsec as _, ++ })) + } + + #[cfg(any(target_os = "vxworks", target_os = "espidf", target_os = "vita"))] + pub fn accessed(&self) -> io::Result { +- Ok(SystemTime::new(self.stat.st_atime as i64, 0)) ++ Ok(SystemTime::from(libc::timespec { ++ tv_sec: self.stat.st_atime as libc::time_t, ++ tv_nsec: 0, ++ })) + } + + #[cfg(any(target_os = "horizon", target_os = "hurd"))] +@@ -529,7 +490,10 @@ pub fn accessed(&self) -> io::Result { + target_os = "watchos", + ))] + pub fn created(&self) -> io::Result { +- Ok(SystemTime::new(self.stat.st_birthtime as i64, self.stat.st_birthtime_nsec as i64)) ++ Ok(SystemTime::from(libc::timespec { ++ tv_sec: self.stat.st_birthtime as libc::time_t, ++ tv_nsec: self.stat.st_birthtime_nsec as libc::c_long, ++ })) + } + + #[cfg(not(any( +@@ -545,7 +509,10 @@ pub fn created(&self) -> io::Result { + cfg_has_statx! { + if let Some(ext) = &self.statx_extra_fields { + return if (ext.stx_mask & libc::STATX_BTIME) != 0 { +- Ok(SystemTime::new(ext.stx_btime.tv_sec, ext.stx_btime.tv_nsec as i64)) ++ Ok(SystemTime::from(libc::timespec { ++ tv_sec: ext.stx_btime.tv_sec as libc::time_t, ++ tv_nsec: ext.stx_btime.tv_nsec as _, ++ })) + } else { + Err(io::const_io_error!( + io::ErrorKind::Uncategorized, +diff --git a/library/std/src/sys/unix/time.rs b/library/std/src/sys/unix/time.rs +index f2e86a4fb2b..fee9e07ec01 100644 +--- a/library/std/src/sys/unix/time.rs ++++ b/library/std/src/sys/unix/time.rs +@@ -34,6 +34,7 @@ pub(in crate::sys::unix) struct Timespec { + + impl SystemTime { + #[cfg_attr(any(target_os = "horizon", target_os = "hurd"), allow(unused))] ++ #[cfg_attr(target_env = "gnu", allow(dead_code))] + pub fn new(tv_sec: i64, tv_nsec: i64) -> SystemTime { + SystemTime { t: Timespec::new(tv_sec, tv_nsec) } + } +-- +2.43.0 + diff --git a/0009-Relocate-unset-tmp.patch b/0009-Relocate-unset-tmp.patch new file mode 100644 index 0000000..58c58db --- /dev/null +++ b/0009-Relocate-unset-tmp.patch @@ -0,0 +1,38 @@ +diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs +index dd9d277fb..160e472cf 100644 +--- a/compiler/rustc_codegen_ssa/src/back/link.rs ++++ b/compiler/rustc_codegen_ssa/src/back/link.rs +@@ -48,7 +48,7 @@ use std::ffi::OsString; + use std::fs::{read, File, OpenOptions}; + use std::io::{BufWriter, Write}; + use std::ops::Deref; +-use std::path::{Path, PathBuf}; ++use std::path::{MAIN_SEPARATOR, Path, PathBuf}; + use std::process::{ExitStatus, Output, Stdio}; + use std::{env, fmt, fs, io, mem, str}; + +@@ -95,11 +95,24 @@ pub fn link_binary<'a>( + }); + + if outputs.outputs.should_link() { ++ let mut clear_tmp = false; ++ if env::var_os("TMPDIR").is_none() && env::var_os("HOME").is_some() { ++ let home_tmp = env::var_os("HOME").unwrap(); ++ let home_tmp = format!("{}{}{}", home_tmp.to_string_lossy(), MAIN_SEPARATOR, ".tmp"); ++ env::set_var("TMPDIR", &home_tmp); ++ if !Path::new(&home_tmp).exists() { ++ let _ = fs::create_dir_all(home_tmp); ++ } ++ clear_tmp = true; ++ } + let tmpdir = TempFileBuilder::new() + .prefix("rustc") + .tempdir() + .unwrap_or_else(|error| sess.emit_fatal(errors::CreateTempDir { error })); + let path = MaybeTempDir::new(tmpdir, sess.opts.cg.save_temps); ++ if clear_tmp { ++ env::remove_var("TMP"); ++ } + let output = out_filename( + sess, + crate_type, diff --git a/rust-1.61.0-i686-unknown-linux-gnu.tar.gz b/rust-1.61.0-i686-unknown-linux-gnu.tar.gz deleted file mode 100644 index 91762a1..0000000 --- a/rust-1.61.0-i686-unknown-linux-gnu.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:b15eb0ad44b7253e0b5b1a8cd285feb10e9fb0402840dba9a13112c3349a4b39 -size 359348717 diff --git a/rust-1.75.0-i686-unknown-linux-gnu.tar.gz b/rust-1.75.0-i686-unknown-linux-gnu.tar.gz new file mode 100644 index 0000000..7eadbbe --- /dev/null +++ b/rust-1.75.0-i686-unknown-linux-gnu.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:107b8d8825deab338f338b15f047829da6225bb34644790847e96f0957c6678f +size 409233544 diff --git a/rust.changes b/rust.changes index 42e9e54..2708ab6 100644 --- a/rust.changes +++ b/rust.changes @@ -1,3 +1,6 @@ +* Fri Mar 15 2024 Ruben De Smet - 1.75.0+git1 +- [rust] Update to version 1.75.0. JB#61739 + * Mon Feb 6 2023 Matti Lehtimäki - 1.61.0+git1 - [rust] Update to version 1.61.0. JB#57222 @@ -16,7 +19,7 @@ * Fri Feb 05 2021 Martin Kampas - 1.44.0+git10 - [rust] Fix host-gcc use under SDK. JB#52983 -* Fri Jan 25 2021 Niels Breet - 1.44.0+git9 +* Fri Jan 29 2021 Niels Breet - 1.44.0+git9 - [aarch64] Enable aarch64 build for rust cross. JB#50499 * Mon Jan 25 2021 Matti Kosola - 1.44.0+git8 diff --git a/rust.spec b/rust.spec index d8f0255..c055ad0 100644 --- a/rust.spec +++ b/rust.spec @@ -11,13 +11,13 @@ %define rust_use_bootstrap 1 %define bootstrap_arches i486 -%global bootstrap_rust 1.61.0 -%global bootstrap_cargo 1.61.0 +%global bootstrap_rust 1.75.0 +%global bootstrap_cargo 1.75.0 # Only x86_64 and i686 are Tier 1 platforms at this time. # https://forge.rust-lang.org/platform-support.html -%global rust_version 1.61.0 +%global rust_version 1.75.0 %ifarch %ix86 %define xbuildjobs %{nil} @@ -76,6 +76,8 @@ Patch4: 0004-Force-the-target-when-building-for-CompileKind-Host.patch Patch5: 0005-Provide-ENV-controls-to-bypass-some-sb2-calls-betwee.patch Patch6: 0006-Scratchbox2-needs-to-be-able-to-tell-cargo-the-defau.patch Patch7: 0007-Disable-aarch64-outline-atomics-for-now.patch +Patch8: 0008-Revert-Use-statx-s-64-bit-times-on-32-bit-linux-gnu.patch +Patch9: 0009-Relocate-unset-tmp.patch # This is the real rustc spec - the stub one appears near the end. %ifarch %ix86 @@ -272,7 +274,7 @@ rm -rf vendor/lzma-sys/xz-*/ rm -rf vendor/openssl-src/openssl/ # This only affects the transient rust-installer, but let it use our dynamic xz-libs -sed -i.lzma -e '/LZMA_API_STATIC/d' src/bootstrap/tool.rs +sed -i.lzma -e '/LZMA_API_STATIC/d' src/bootstrap/src/core/build_steps/tool.rs # The configure macro will modify some autoconf-related files, which upsets # cargo when it tries to verify checksums in those files. If we just truncate diff --git a/rustc-1.61.0-src.tar.gz b/rustc-1.61.0-src.tar.gz deleted file mode 100644 index c7fd631..0000000 --- a/rustc-1.61.0-src.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:ad0b4351675aa9abdf4c7e066613bd274c4391c5506db152983426376101daed -size 203300188 diff --git a/rustc-1.75.0-src.tar.gz b/rustc-1.75.0-src.tar.gz new file mode 100644 index 0000000..98e0fa6 --- /dev/null +++ b/rustc-1.75.0-src.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5b739f45bc9d341e2d1c570d65d2375591e22c2d23ef5b8a37711a0386abc088 +size 285857065