Skip to content

Commit

Permalink
Auto merge of rust-lang#117339 - workingjubilee:rollup-wiv53ci, r=wor…
Browse files Browse the repository at this point in the history
…kingjubilee

Rollup of 5 pull requests

Successful merges:

 - rust-lang#115968 (Don't use LFS64 symbols on musl)
 - rust-lang#117043 (add bootstrap flag `--skip-stage0-validation`)
 - rust-lang#117082 (Fix closure-inherit-target-feature test for SGX platform)
 - rust-lang#117312 (memcpy assumptions: link to source showing that GCC makes the same assumption)
 - rust-lang#117328 (pass `CODEGEN_BACKENDS` to docker)

r? `@ghost`
`@rustbot` modify labels: rollup
  • Loading branch information
bors committed Oct 29, 2023
2 parents bbcc169 + 6995b5e commit 89fa2f3
Show file tree
Hide file tree
Showing 13 changed files with 119 additions and 32 deletions.
3 changes: 2 additions & 1 deletion library/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
//! assumptions about their semantics: For `memcpy`, `memmove`, `memset`, `memcmp`, and `bcmp`, if
//! the `n` parameter is 0, the function is assumed to not be UB. Furthermore, for `memcpy`, if
//! source and target pointer are equal, the function is assumed to not be UB.
//! (Note that these are [standard assumptions](https://reviews.llvm.org/D86993) among compilers.)
//! (Note that these are standard assumptions among compilers:
//! [clang](https://reviews.llvm.org/D86993) and [GCC](https://gcc.gnu.org/bugzilla/show_bug.cgi?id=32667) do the same.)
//! These functions are often provided by the system libc, but can also be provided by the
//! [compiler-builtins crate](https://crates.io/crates/compiler_builtins).
//! Note that the library does not guarantee that it will always make these assumptions, so Rust
Expand Down
9 changes: 8 additions & 1 deletion library/std/src/os/linux/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,14 @@ pub trait MetadataExt {
impl MetadataExt for Metadata {
#[allow(deprecated)]
fn as_raw_stat(&self) -> &raw::stat {
unsafe { &*(self.as_inner().as_inner() as *const libc::stat64 as *const raw::stat) }
#[cfg(target_env = "musl")]
unsafe {
&*(self.as_inner().as_inner() as *const libc::stat as *const raw::stat)
}
#[cfg(not(target_env = "musl"))]
unsafe {
&*(self.as_inner().as_inner() as *const libc::stat64 as *const raw::stat)
}
}
fn st_dev(&self) -> u64 {
self.as_inner().as_inner().st_dev as u64
Expand Down
24 changes: 20 additions & 4 deletions library/std/src/sys/unix/fd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,17 @@ impl FileDesc {
}

pub fn read_at(&self, buf: &mut [u8], offset: u64) -> io::Result<usize> {
#[cfg(not(any(target_os = "linux", target_os = "android", target_os = "hurd")))]
#[cfg(not(any(
all(target_os = "linux", not(target_env = "musl")),
target_os = "android",
target_os = "hurd"
)))]
use libc::pread as pread64;
#[cfg(any(target_os = "linux", target_os = "android", target_os = "hurd"))]
#[cfg(any(
all(target_os = "linux", not(target_env = "musl")),
target_os = "android",
target_os = "hurd"
))]
use libc::pread64;

unsafe {
Expand Down Expand Up @@ -285,9 +293,17 @@ impl FileDesc {
}

pub fn write_at(&self, buf: &[u8], offset: u64) -> io::Result<usize> {
#[cfg(not(any(target_os = "linux", target_os = "android", target_os = "hurd")))]
#[cfg(not(any(
all(target_os = "linux", not(target_env = "musl")),
target_os = "android",
target_os = "hurd"
)))]
use libc::pwrite as pwrite64;
#[cfg(any(target_os = "linux", target_os = "android", target_os = "hurd"))]
#[cfg(any(
all(target_os = "linux", not(target_env = "musl")),
target_os = "android",
target_os = "hurd"
))]
use libc::pwrite64;

unsafe {
Expand Down
23 changes: 14 additions & 9 deletions library/std/src/sys/unix/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,17 @@ use libc::{c_int, mode_t};
))]
use libc::c_char;
#[cfg(any(
target_os = "linux",
all(target_os = "linux", not(target_env = "musl")),
target_os = "emscripten",
target_os = "android",
target_os = "hurd",
target_os = "hurd"
))]
use libc::dirfd;
#[cfg(any(target_os = "linux", target_os = "emscripten", target_os = "hurd"))]
#[cfg(any(
all(target_os = "linux", not(target_env = "musl")),
target_os = "emscripten",
target_os = "hurd"
))]
use libc::fstatat64;
#[cfg(any(
target_os = "android",
Expand All @@ -57,9 +61,10 @@ use libc::fstatat64;
target_os = "aix",
target_os = "nto",
target_os = "vita",
all(target_os = "linux", target_env = "musl"),
))]
use libc::readdir as readdir64;
#[cfg(any(target_os = "linux", target_os = "hurd"))]
#[cfg(any(all(target_os = "linux", not(target_env = "musl")), target_os = "hurd"))]
use libc::readdir64;
#[cfg(any(target_os = "emscripten", target_os = "l4re"))]
use libc::readdir64_r;
Expand All @@ -84,7 +89,7 @@ use libc::{
lstat as lstat64, off64_t, open as open64, stat as stat64,
};
#[cfg(not(any(
target_os = "linux",
all(target_os = "linux", not(target_env = "musl")),
target_os = "emscripten",
target_os = "l4re",
target_os = "android",
Expand All @@ -95,7 +100,7 @@ use libc::{
lstat as lstat64, off_t as off64_t, open as open64, stat as stat64,
};
#[cfg(any(
target_os = "linux",
all(target_os = "linux", not(target_env = "musl")),
target_os = "emscripten",
target_os = "l4re",
target_os = "hurd"
Expand Down Expand Up @@ -853,10 +858,10 @@ impl DirEntry {

#[cfg(all(
any(
target_os = "linux",
all(target_os = "linux", not(target_env = "musl")),
target_os = "emscripten",
target_os = "android",
target_os = "hurd",
target_os = "hurd"
),
not(miri)
))]
Expand All @@ -882,7 +887,7 @@ impl DirEntry {

#[cfg(any(
not(any(
target_os = "linux",
all(target_os = "linux", not(target_env = "musl")),
target_os = "emscripten",
target_os = "android",
target_os = "hurd",
Expand Down
7 changes: 7 additions & 0 deletions src/bootstrap/src/core/build_steps/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1305,6 +1305,10 @@ impl Step for CodegenBackend {
return None;
}

if !builder.config.rust_codegen_backends.contains(&self.backend) {
return None;
}

if self.backend == "cranelift" {
if !target_supports_cranelift_backend(self.compiler.host) {
builder.info("target not supported by rustc_codegen_cranelift. skipping");
Expand Down Expand Up @@ -1343,12 +1347,15 @@ impl Step for CodegenBackend {
let backends_dst = PathBuf::from("lib").join(&backends_rel);

let backend_name = format!("rustc_codegen_{}", backend);
let mut found_backend = false;
for backend in fs::read_dir(&backends_src).unwrap() {
let file_name = backend.unwrap().file_name();
if file_name.to_str().unwrap().contains(&backend_name) {
tarball.add_file(backends_src.join(file_name), &backends_dst, 0o644);
found_backend = true;
}
}
assert!(found_backend);

Some(tarball.generate())
}
Expand Down
5 changes: 3 additions & 2 deletions src/bootstrap/src/core/config/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1274,8 +1274,9 @@ impl Config {
}

config.initial_rustc = if let Some(rustc) = build.rustc {
// FIXME(#115065): re-enable this check
// config.check_build_rustc_version(&rustc);
if !flags.skip_stage0_validation {
config.check_build_rustc_version(&rustc);
}
PathBuf::from(rustc)
} else {
config.download_beta_toolchain();
Expand Down
3 changes: 3 additions & 0 deletions src/bootstrap/src/core/config/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@ pub struct Flags {
/// Enable BOLT link flags
#[arg(global(true), long)]
pub enable_bolt_settings: bool,
/// Skip stage0 compiler validation
#[arg(global(true), long)]
pub skip_stage0_validation: bool,
/// Additional reproducible artifacts that should be added to the reproducible artifacts archive.
#[arg(global(true), long)]
pub reproducible_artifact: Vec<String>,
Expand Down
1 change: 1 addition & 0 deletions src/ci/docker/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ docker \
--env DIST_TRY_BUILD \
--env PR_CI_JOB \
--env OBJDIR_ON_HOST="$objdir" \
--env CODEGEN_BACKENDS \
--init \
--rm \
rust-ci \
Expand Down
Loading

0 comments on commit 89fa2f3

Please sign in to comment.