Skip to content

Commit

Permalink
Rebase patches onto 1.73
Browse files Browse the repository at this point in the history
  • Loading branch information
rubdos committed Oct 26, 2023
1 parent 1b83a42 commit 2c5c024
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 45 deletions.
5 changes: 4 additions & 1 deletion 0001-Set-proper-llvm-targets.patch
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Signed-off-by: Ruben De Smet <[email protected]>
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/config.example.toml b/config.example.toml
index 0c65b25fe13..43beaed6e7b 100644
index 5c4bee87553..63946e46122 100644
--- a/config.example.toml
+++ b/config.example.toml
@@ -88,7 +88,7 @@ changelog-seen = 2
Expand All @@ -22,3 +22,6 @@ index 0c65b25fe13..43beaed6e7b 100644

# 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.42.0

9 changes: 6 additions & 3 deletions 0002-Disable-statx-for-all-builds.-JB-50106.patch
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ Signed-off-by: Ruben De Smet <[email protected]>
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 fbc7f04ce9a..bf49ad70590 100644
index a5604c92a80..8438d7dcc30 100644
--- a/library/std/src/sys/unix/fs.rs
+++ b/library/std/src/sys/unix/fs.rs
@@ -28,28 +28,11 @@
@@ -17,28 +17,11 @@
use crate::sys::{cvt, cvt_r};
use crate::sys_common::{AsInner, AsInnerMut, FromInner, IntoInner};

Expand Down Expand Up @@ -52,7 +52,7 @@ index fbc7f04ce9a..bf49ad70590 100644
#[cfg(any(target_os = "linux", target_os = "emscripten", target_os = "android"))]
use libc::dirfd;
#[cfg(any(target_os = "linux", target_os = "emscripten"))]
@@ -109,20 +92,9 @@
@@ -98,20 +81,9 @@
// https://github.com/rust-lang/rust/pull/67774
macro_rules! cfg_has_statx {
({ $($then_tt:tt)* } else { $($else_tt:tt)* }) => {
Expand All @@ -75,3 +75,6 @@ index fbc7f04ce9a..bf49ad70590 100644
}

cfg_has_statx! {{
--
2.42.0

Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ Signed-off-by: Ruben De Smet <[email protected]>
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs
index f97cb3440d2..9b96d0d2e57 100644
index f00472f181d..a2b9fbf82db 100644
--- a/compiler/rustc_session/src/config.rs
+++ b/compiler/rustc_session/src/config.rs
@@ -2170,7 +2170,14 @@ pub fn parse_target_triple(
@@ -2226,7 +2226,14 @@ pub fn parse_target_triple(
})
}
Some(target) => TargetTriple::TargetTriple(target),
Expand All @@ -34,3 +34,6 @@ index f97cb3440d2..9b96d0d2e57 100644
}
}

--
2.42.0

Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Signed-off-by: Ruben De Smet <[email protected]>
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 31e63c226..976b101fd 100644
index 7024a2ac5..ebce975a9 100644
--- a/src/tools/cargo/src/cargo/core/compiler/mod.rs
+++ b/src/tools/cargo/src/cargo/core/compiler/mod.rs
@@ -1111,6 +1111,9 @@ fn build_base_args(cx: &Context<'_, '_>, cmd: &mut ProcessBuilder, unit: &Unit)
Expand All @@ -25,3 +25,6 @@ index 31e63c226..976b101fd 100644
}

opt(
--
2.42.0

35 changes: 19 additions & 16 deletions 0005-Provide-ENV-controls-to-bypass-some-sb2-calls-betwee.patch
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,10 @@ index 640648e8707..f15625e0514 100644
// 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 0ce93af66ac..04449d859bf 100644
index 3963e7f52d5..d08e4db6199 100644
--- a/library/std/src/sys/unix/process/process_unix.rs
+++ b/library/std/src/sys/unix/process/process_unix.rs
@@ -28,7 +28,7 @@
@@ -25,7 +25,7 @@
use libc::RTP_ID as pid_t;

#[cfg(not(target_os = "vxworks"))]
Expand All @@ -167,7 +167,7 @@ index 0ce93af66ac..04449d859bf 100644

#[cfg(not(any(
target_os = "vxworks",
@@ -65,6 +65,10 @@ fn get_clock_resolution() -> Duration {
@@ -62,6 +62,10 @@ fn get_clock_resolution() -> Duration {
}
}

Expand All @@ -178,8 +178,8 @@ index 0ce93af66ac..04449d859bf 100644
////////////////////////////////////////////////////////////////////////////////
// Command
////////////////////////////////////////////////////////////////////////////////
@@ -93,6 +97,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 @@ -244,16 +244,16 @@ index 0ce93af66ac..04449d859bf 100644
// 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
@@ -109,7 +172,7 @@ pub fn spawn(
@@ -111,7 +174,7 @@ pub fn spawn(
if pid == 0 {
crate::panic::always_abort();
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();
@@ -336,7 +399,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,48 @@ pub fn exec(&mut self, default: Stdio) -> io::Error {
Err(e) => e,
}
}
Expand Down Expand Up @@ -303,7 +303,7 @@ index 0ce93af66ac..04449d859bf 100644
// 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
@@ -376,13 +480,13 @@ unsafe fn do_exec(
@@ -308,13 +412,13 @@ unsafe fn do_exec(
use crate::sys::{self, cvt_r};

if let Some(fd) = stdio.stdin.fd() {
Expand All @@ -320,7 +320,7 @@ index 0ce93af66ac..04449d859bf 100644
}

#[cfg(not(target_os = "l4re"))]
@@ -390,10 +494,10 @@ unsafe fn do_exec(
@@ -322,10 +426,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 @@ -333,7 +333,7 @@ index 0ce93af66ac..04449d859bf 100644
}
if let Some(u) = self.get_uid() {
// When dropping privileges from root, the `setgroups` call
@@ -405,13 +509,13 @@ unsafe fn do_exec(
@@ -337,13 +441,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() {
Expand All @@ -350,7 +350,7 @@ index 0ce93af66ac..04449d859bf 100644
}

if let Some(pgroup) = self.get_pgroup() {
@@ -469,8 +573,12 @@ fn drop(&mut self) {
@@ -401,8 +505,12 @@ fn drop(&mut self) {
_reset = Some(Reset(*sys::os::environ()));
*sys::os::environ() = envp.as_ptr();
}
Expand All @@ -365,15 +365,15 @@ index 0ce93af66ac..04449d859bf 100644
Err(io::Error::last_os_error())
}

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

@@ -520,12 +629,15 @@ fn posix_spawn(
@@ -452,12 +561,15 @@ fn posix_spawn(
use crate::mem::MaybeUninit;
use crate::sys::{self, cvt_nz, unix_sigpipe_attr_specified};

Expand All @@ -389,3 +389,6 @@ index 0ce93af66ac..04449d859bf 100644
{
return Ok(None);
}
--
2.42.0

Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ Signed-off-by: Ruben De Smet <[email protected]>
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 73d8f89cc..d35f55d11 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
@@ -71,7 +71,13 @@ impl CompileKind {
}

let kinds = match &config.build_config()?.target {
- None => Ok(vec![CompileKind::Host]),
+ None => {
Expand All @@ -29,3 +29,7 @@ index 73d8f89cc..d35f55d11 100644
+ }
Some(build_target_config) => dedup(&build_target_config.values(config)?),
};

--
2.42.0

3 changes: 3 additions & 0 deletions 0007-Disable-aarch64-outline-atomics-for-now.patch
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,6 @@ index da246089440..8c5daccc331 100644
mcount: "\u{1}_mcount".into(),
max_atomic_width: Some(128),
supported_sanitizers: SanitizerSet::ADDRESS
--
2.42.0

43 changes: 23 additions & 20 deletions 0008-Revert-Use-statx-s-64-bit-times-on-32-bit-linux-gnu.patch
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ index 479bbcc17a8..2e90d8d6be7 100644
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 bf49ad70590..ff01830e0f6 100644
index 8438d7dcc30..c5ca8582f88 100644
--- a/library/std/src/sys/unix/fs.rs
+++ b/library/std/src/sys/unix/fs.rs
@@ -109,19 +109,10 @@ struct StatxExtraFields {
@@ -98,19 +98,10 @@ struct StatxExtraFields {
// This is needed to check if btime is supported by the filesystem.
stx_mask: u32,
stx_btime: libc::statx_timestamp,
Expand All @@ -71,7 +71,7 @@ index bf49ad70590..ff01830e0f6 100644
- 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`.
Expand All @@ -80,7 +80,7 @@ index bf49ad70590..ff01830e0f6 100644
unsafe fn try_statx(
fd: c_int,
path: *const c_char,
@@ -211,13 +202,6 @@ fn statx(
@@ -200,13 +191,6 @@ fn statx(
let extra = StatxExtraFields {
stx_mask: buf.stx_mask,
stx_btime: buf.stx_btime,
Expand All @@ -92,9 +92,9 @@ index bf49ad70590..ff01830e0f6 100644
- #[cfg(target_pointer_width = "32")]
- stx_mtime: buf.stx_mtime,
};

Some(Ok(FileAttr { stat, statx_extra_fields: Some(extra) }))
@@ -365,36 +349,6 @@ impl FileAttr {
@@ -354,36 +338,6 @@ impl FileAttr {
fn from_stat64(stat: stat64) -> Self {
Self { stat, statx_extra_fields: None }
}
Expand Down Expand Up @@ -131,7 +131,7 @@ index bf49ad70590..ff01830e0f6 100644
}
} else {
impl FileAttr {
@@ -420,15 +374,24 @@ pub fn file_type(&self) -> FileType {
@@ -409,15 +363,24 @@ pub fn file_type(&self) -> FileType {
#[cfg(target_os = "netbsd")]
impl FileAttr {
pub fn modified(&self) -> io::Result<SystemTime> {
Expand All @@ -141,15 +141,15 @@ index bf49ad70590..ff01830e0f6 100644
+ tv_nsec: self.stat.st_mtimensec as libc::c_long,
+ }))
}

pub fn accessed(&self) -> io::Result<SystemTime> {
- 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<SystemTime> {
- Ok(SystemTime::new(self.stat.st_birthtime as i64, self.stat.st_birthtimensec as i64))
+ Ok(SystemTime::from(libc::timespec {
Expand All @@ -158,8 +158,8 @@ index bf49ad70590..ff01830e0f6 100644
+ }))
}
}

@@ -441,19 +404,18 @@ impl FileAttr {
@@ -430,19 +393,18 @@ impl FileAttr {
target_os = "vita"
)))]
pub fn modified(&self) -> io::Result<SystemTime> {
Expand All @@ -176,7 +176,7 @@ index bf49ad70590..ff01830e0f6 100644
+ 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<SystemTime> {
- Ok(SystemTime::new(self.stat.st_mtime as i64, 0))
Expand All @@ -185,9 +185,9 @@ index bf49ad70590..ff01830e0f6 100644
+ tv_nsec: 0,
+ }))
}

#[cfg(target_os = "horizon")]
@@ -468,19 +430,18 @@ pub fn modified(&self) -> io::Result<SystemTime> {
@@ -457,19 +419,18 @@ pub fn modified(&self) -> io::Result<SystemTime> {
target_os = "vita"
)))]
pub fn accessed(&self) -> io::Result<SystemTime> {
Expand All @@ -204,7 +204,7 @@ index bf49ad70590..ff01830e0f6 100644
+ 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<SystemTime> {
- Ok(SystemTime::new(self.stat.st_atime as i64, 0))
Expand All @@ -213,9 +213,9 @@ index bf49ad70590..ff01830e0f6 100644
+ tv_nsec: 0,
+ }))
}

#[cfg(target_os = "horizon")]
@@ -497,7 +458,10 @@ pub fn accessed(&self) -> io::Result<SystemTime> {
@@ -486,7 +447,10 @@ pub fn accessed(&self) -> io::Result<SystemTime> {
target_os = "watchos",
))]
pub fn created(&self) -> io::Result<SystemTime> {
Expand All @@ -225,9 +225,9 @@ index bf49ad70590..ff01830e0f6 100644
+ tv_nsec: self.stat.st_birthtime_nsec as libc::c_long,
+ }))
}

#[cfg(not(any(
@@ -513,7 +477,10 @@ pub fn created(&self) -> io::Result<SystemTime> {
@@ -502,7 +466,10 @@ pub fn created(&self) -> io::Result<SystemTime> {
cfg_has_statx! {
if let Some(ext) = &self.statx_extra_fields {
return if (ext.stx_mask & libc::STATX_BTIME) != 0 {
Expand All @@ -244,10 +244,13 @@ index 17b4130c202..4e8dd9a86e7 100644
--- a/library/std/src/sys/unix/time.rs
+++ b/library/std/src/sys/unix/time.rs
@@ -36,6 +36,7 @@ pub(in crate::sys::unix) struct Timespec {

impl SystemTime {
#[cfg_attr(target_os = "horizon", 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.42.0

0 comments on commit 2c5c024

Please sign in to comment.