Skip to content

Rust 1.72.1 #20

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

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions 0001-Set-proper-llvm-targets.patch
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ Subject: [PATCH] Set proper llvm targets.
Signed-off-by: Matti Kosola <[email protected]>
Signed-off-by: Ruben De Smet <[email protected]>
---
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 0c65b25fe13..43beaed6e7b 100644
--- a/config.example.toml
+++ b/config.example.toml
@@ -88,7 +88,7 @@ changelog-seen = 2
# 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
Expand Down
17 changes: 11 additions & 6 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 <[email protected]
Signed-off-by: Matti Kosola <[email protected]>
Signed-off-by: Ruben De Smet <[email protected]>
---
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 fbc7f04ce9a..bf49ad70590 100644
--- a/library/std/src/sys/unix/fs.rs
+++ b/library/std/src/sys/unix/fs.rs
@@ -13,23 +13,11 @@
@@ -28,28 +28,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 @@
@@ -109,20 +92,9 @@
// https://github.com/rust-lang/rust/pull/67774
macro_rules! cfg_has_statx {
({ $($then_tt:tt)* } else { $($else_tt:tt)* }) => {
Expand Down
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 4182a5d07118e0652ff63c4bec28bde0775d0c59..9904ab2e70d7aafab4ec63e86d0cdb383ca2285b 100644
index f97cb3440d2..9b96d0d2e57 100644
--- a/compiler/rustc_session/src/config.rs
+++ b/compiler/rustc_session/src/config.rs
@@ -1848,7 +1848,14 @@ pub fn parse_target_triple(
@@ -2170,7 +2170,14 @@ pub fn parse_target_triple(
})
}
Some(target) => TargetTriple::TargetTriple(target),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,16 @@ 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
--- 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(
75 changes: 39 additions & 36 deletions 0005-Provide-ENV-controls-to-bypass-some-sb2-calls-betwee.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: David Greaves <[email protected]>
Date: Wed, 20 Jan 2021 09:40:34 +0000
Subject: [PATCH] Provide ENV controls to bypass some sb2 calls between fork
exec
Subject: [PATCH] Provide ENV controls to bypass some sb2 calls between
fork exec

In threaded systems there can be deadlocks caused by calling malloc
after fork and before exec. Rust manages this but sb2 does not.
Expand Down Expand Up @@ -35,15 +35,15 @@ needed to support the SHIM functionality
Signed-off-by: David Greaves <[email protected]>
Signed-off-by: Ruben De Smet <[email protected]>
---
.../src/sys/unix/process/process_common.rs | 50 ++++++-
.../src/sys/unix/process/process_common.rs | 55 ++++++-
.../std/src/sys/unix/process/process_unix.rs | 138 ++++++++++++++++--
2 files changed, 170 insertions(+), 18 deletions(-)
2 files changed, 173 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 640648e8707..f15625e0514 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! {
@@ -84,7 +84,7 @@ pub unsafe fn sigaddset(set: *mut libc::sigset_t, signum: libc::c_int) -> libc::
////////////////////////////////////////////////////////////////////////////////

pub struct Command {
Expand All @@ -52,7 +52,7 @@ index 27bee714f5b4317132db508fe916c7e194d05bc5..7746177e0423b7689833cc84b6132240
args: Vec<CString>,
/// Exactly what will be passed to `execvp`.
///
@@ -70,6 +70,13 @@ pub struct Command {
@@ -93,6 +93,13 @@ pub struct Command {
/// `args` to properly update this as well.
argv: Argv,
env: CommandEnv,
Expand All @@ -64,9 +64,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 {
@@ -109,6 +116,14 @@ pub struct Command {
pgroup: Option<pid_t>,
}

Expand All @@ -81,18 +81,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 {
@@ -181,16 +196,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 +109,18 @@ index 27bee714f5b4317132db508fe916c7e194d05bc5..7746177e0423b7689833cc84b6132240
closures: Vec::new(),
groups: None,
stdin: None,
@@ -154,15 +177,23 @@ impl Command {
pub fn new(program: &OsStr) -> Command {
@@ -205,16 +228,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 +137,7 @@ index 27bee714f5b4317132db508fe916c7e194d05bc5..7746177e0423b7689833cc84b6132240
closures: Vec::new(),
groups: None,
stdin: None,
@@ -173,6 +204,16 @@ impl Command {
@@ -225,6 +256,16 @@ pub fn new(program: &OsStr) -> Command {
}
}

Expand All @@ -155,18 +155,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 0ce93af66ac..04449d859bf 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 @@
@@ -28,7 +28,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",
@@ -65,6 +65,10 @@ fn get_clock_resolution() -> Duration {
}
}

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

@@ -93,6 +97,65 @@ pub fn spawn(
}
let (input, output) = sys::pipe::anon_pipe()?;

+ // If there is a RUST_EXEC_SHIM (could be "/usr/bin/env --")
Expand Down Expand Up @@ -241,16 +244,16 @@ 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(
@@ -109,7 +172,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 {
@@ -336,7 +399,48 @@ pub fn exec(&mut self, default: Stdio) -> io::Error {
Err(e) => e,
}
}
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(
@@ -376,13 +480,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(
@@ -390,10 +494,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(
@@ -405,13 +509,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) {
@@ -469,8 +573,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(
@@ -497,6 +605,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(
@@ -520,12 +629,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 Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ 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 c3c921d41..d8a08582a 100644
index 73d8f89cc..d35f55d11 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 {
Expand All @@ -26,6 +26,6 @@ index c3c921d41..d8a08582a 100644
+ } else {
+ Ok(vec![CompileKind::Host])
+ }
+ },
+ }
Some(build_target_config) => dedup(&build_target_config.values(config)?),
};
11 changes: 6 additions & 5 deletions 0007-Disable-aarch64-outline-atomics-for-now.patch
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,19 @@ The feature causes linking problems.

Signed-off-by: Matti Lehtimäki <[email protected]>
---
compiler/rustc_target/src/spec/aarch64_unknown_linux_gnu.rs | 1 -
1 file changed, 1 deletion(-)
compiler/rustc_target/src/spec/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
index da246089440..8c5daccc331 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 {
@@ -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
Loading