From 7300bd5c2306cbb0e8a8893a9f5ccf7617e70b45 Mon Sep 17 00:00:00 2001 From: Matti Viljanen Date: Fri, 14 Jun 2024 11:09:59 +0300 Subject: [PATCH] [rust] Remove unneeded patches due to updated GCC and SB2 statx support --- ...sable-statx-for-all-builds.-JB-50106.patch | 80 ------ ...able-aarch64-outline-atomics-for-now.patch | 31 --- ...x-s-64-bit-times-on-32-bit-linux-gnu.patch | 256 ------------------ rust.spec | 3 - 4 files changed, 370 deletions(-) delete mode 100644 0002-Disable-statx-for-all-builds.-JB-50106.patch delete mode 100644 0007-Disable-aarch64-outline-atomics-for-now.patch delete mode 100644 0008-Revert-Use-statx-s-64-bit-times-on-32-bit-linux-gnu.patch diff --git a/0002-Disable-statx-for-all-builds.-JB-50106.patch b/0002-Disable-statx-for-all-builds.-JB-50106.patch deleted file mode 100644 index cb2de22..0000000 --- a/0002-Disable-statx-for-all-builds.-JB-50106.patch +++ /dev/null @@ -1,80 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Niels Breet -Date: Tue, 11 May 2021 13:03:55 +0300 -Subject: [PATCH] Disable statx for all builds. JB#50106 -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -libstd implements statx using syscall and thus it will not work on -scratchbox2. Moreover as it is supported only by Linux 4.11 and newer -it's little use for us at the moment. It can be disabled and which means -that optional extra information is set to None. Software should handle -that gracefully without issues thanks to rust's type system. - -Signed-off-by: Tomi Leppänen -Signed-off-by: Ruben De Smet ---- - 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 40eb910fdc3..8798aa7061c 100644 ---- a/library/std/src/sys/unix/fs.rs -+++ b/library/std/src/sys/unix/fs.rs -@@ -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(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( - 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)* }) => { -- cfg_if::cfg_if! { -- if #[cfg(all(target_os = "linux", target_env = "gnu"))] { -- $($then_tt)* -- } else { -- $($else_tt)* -- } -- } -- }; -- ($($block_inner:tt)*) => { -- #[cfg(all(target_os = "linux", target_env = "gnu"))] -- { -- $($block_inner)* -- } -+ $($else_tt)* - }; -+ ($($block_inner:tt)*) => {}; - } - - cfg_has_statx! {{ --- -2.43.0 - diff --git a/0007-Disable-aarch64-outline-atomics-for-now.patch b/0007-Disable-aarch64-outline-atomics-for-now.patch deleted file mode 100644 index bf5d1b0..0000000 --- a/0007-Disable-aarch64-outline-atomics-for-now.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Matti=20Lehtim=C3=A4ki?= -Date: Wed, 18 Jan 2023 20:13:21 +0200 -Subject: [PATCH] Disable aarch64 outline atomics for now. -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The feature causes linking problems. - -Signed-off-by: Matti Lehtimäki ---- - .../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/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: "+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 deleted file mode 100644 index 2b143b2..0000000 --- a/0008-Revert-Use-statx-s-64-bit-times-on-32-bit-linux-gnu.patch +++ /dev/null @@ -1,256 +0,0 @@ -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/rust.spec b/rust.spec index c055ad0..143bfb0 100644 --- a/rust.spec +++ b/rust.spec @@ -70,13 +70,10 @@ Source100: rust-%{rust_version}-i686-unknown-linux-gnu.tar.gz Source200: README.md Patch1: 0001-Set-proper-llvm-targets.patch -Patch2: 0002-Disable-statx-for-all-builds.-JB-50106.patch Patch3: 0003-Scratchbox2-needs-to-be-able-to-tell-rustc-the-defau.patch 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