Skip to content

Commit 89fa2f3

Browse files
committed
Auto merge of rust-lang#117339 - workingjubilee:rollup-wiv53ci, r=workingjubilee
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
2 parents bbcc169 + 6995b5e commit 89fa2f3

File tree

13 files changed

+119
-32
lines changed

13 files changed

+119
-32
lines changed

library/core/src/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
//! assumptions about their semantics: For `memcpy`, `memmove`, `memset`, `memcmp`, and `bcmp`, if
2727
//! the `n` parameter is 0, the function is assumed to not be UB. Furthermore, for `memcpy`, if
2828
//! source and target pointer are equal, the function is assumed to not be UB.
29-
//! (Note that these are [standard assumptions](https://reviews.llvm.org/D86993) among compilers.)
29+
//! (Note that these are standard assumptions among compilers:
30+
//! [clang](https://reviews.llvm.org/D86993) and [GCC](https://gcc.gnu.org/bugzilla/show_bug.cgi?id=32667) do the same.)
3031
//! These functions are often provided by the system libc, but can also be provided by the
3132
//! [compiler-builtins crate](https://crates.io/crates/compiler_builtins).
3233
//! Note that the library does not guarantee that it will always make these assumptions, so Rust

library/std/src/os/linux/fs.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,14 @@ pub trait MetadataExt {
329329
impl MetadataExt for Metadata {
330330
#[allow(deprecated)]
331331
fn as_raw_stat(&self) -> &raw::stat {
332-
unsafe { &*(self.as_inner().as_inner() as *const libc::stat64 as *const raw::stat) }
332+
#[cfg(target_env = "musl")]
333+
unsafe {
334+
&*(self.as_inner().as_inner() as *const libc::stat as *const raw::stat)
335+
}
336+
#[cfg(not(target_env = "musl"))]
337+
unsafe {
338+
&*(self.as_inner().as_inner() as *const libc::stat64 as *const raw::stat)
339+
}
333340
}
334341
fn st_dev(&self) -> u64 {
335342
self.as_inner().as_inner().st_dev as u64

library/std/src/sys/unix/fd.rs

+20-4
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,17 @@ impl FileDesc {
126126
}
127127

128128
pub fn read_at(&self, buf: &mut [u8], offset: u64) -> io::Result<usize> {
129-
#[cfg(not(any(target_os = "linux", target_os = "android", target_os = "hurd")))]
129+
#[cfg(not(any(
130+
all(target_os = "linux", not(target_env = "musl")),
131+
target_os = "android",
132+
target_os = "hurd"
133+
)))]
130134
use libc::pread as pread64;
131-
#[cfg(any(target_os = "linux", target_os = "android", target_os = "hurd"))]
135+
#[cfg(any(
136+
all(target_os = "linux", not(target_env = "musl")),
137+
target_os = "android",
138+
target_os = "hurd"
139+
))]
132140
use libc::pread64;
133141

134142
unsafe {
@@ -285,9 +293,17 @@ impl FileDesc {
285293
}
286294

287295
pub fn write_at(&self, buf: &[u8], offset: u64) -> io::Result<usize> {
288-
#[cfg(not(any(target_os = "linux", target_os = "android", target_os = "hurd")))]
296+
#[cfg(not(any(
297+
all(target_os = "linux", not(target_env = "musl")),
298+
target_os = "android",
299+
target_os = "hurd"
300+
)))]
289301
use libc::pwrite as pwrite64;
290-
#[cfg(any(target_os = "linux", target_os = "android", target_os = "hurd"))]
302+
#[cfg(any(
303+
all(target_os = "linux", not(target_env = "musl")),
304+
target_os = "android",
305+
target_os = "hurd"
306+
))]
291307
use libc::pwrite64;
292308

293309
unsafe {

library/std/src/sys/unix/fs.rs

+14-9
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,17 @@ use libc::{c_int, mode_t};
4040
))]
4141
use libc::c_char;
4242
#[cfg(any(
43-
target_os = "linux",
43+
all(target_os = "linux", not(target_env = "musl")),
4444
target_os = "emscripten",
4545
target_os = "android",
46-
target_os = "hurd",
46+
target_os = "hurd"
4747
))]
4848
use libc::dirfd;
49-
#[cfg(any(target_os = "linux", target_os = "emscripten", target_os = "hurd"))]
49+
#[cfg(any(
50+
all(target_os = "linux", not(target_env = "musl")),
51+
target_os = "emscripten",
52+
target_os = "hurd"
53+
))]
5054
use libc::fstatat64;
5155
#[cfg(any(
5256
target_os = "android",
@@ -57,9 +61,10 @@ use libc::fstatat64;
5761
target_os = "aix",
5862
target_os = "nto",
5963
target_os = "vita",
64+
all(target_os = "linux", target_env = "musl"),
6065
))]
6166
use libc::readdir as readdir64;
62-
#[cfg(any(target_os = "linux", target_os = "hurd"))]
67+
#[cfg(any(all(target_os = "linux", not(target_env = "musl")), target_os = "hurd"))]
6368
use libc::readdir64;
6469
#[cfg(any(target_os = "emscripten", target_os = "l4re"))]
6570
use libc::readdir64_r;
@@ -84,7 +89,7 @@ use libc::{
8489
lstat as lstat64, off64_t, open as open64, stat as stat64,
8590
};
8691
#[cfg(not(any(
87-
target_os = "linux",
92+
all(target_os = "linux", not(target_env = "musl")),
8893
target_os = "emscripten",
8994
target_os = "l4re",
9095
target_os = "android",
@@ -95,7 +100,7 @@ use libc::{
95100
lstat as lstat64, off_t as off64_t, open as open64, stat as stat64,
96101
};
97102
#[cfg(any(
98-
target_os = "linux",
103+
all(target_os = "linux", not(target_env = "musl")),
99104
target_os = "emscripten",
100105
target_os = "l4re",
101106
target_os = "hurd"
@@ -853,10 +858,10 @@ impl DirEntry {
853858

854859
#[cfg(all(
855860
any(
856-
target_os = "linux",
861+
all(target_os = "linux", not(target_env = "musl")),
857862
target_os = "emscripten",
858863
target_os = "android",
859-
target_os = "hurd",
864+
target_os = "hurd"
860865
),
861866
not(miri)
862867
))]
@@ -882,7 +887,7 @@ impl DirEntry {
882887

883888
#[cfg(any(
884889
not(any(
885-
target_os = "linux",
890+
all(target_os = "linux", not(target_env = "musl")),
886891
target_os = "emscripten",
887892
target_os = "android",
888893
target_os = "hurd",

src/bootstrap/src/core/build_steps/dist.rs

+7
Original file line numberDiff line numberDiff line change
@@ -1305,6 +1305,10 @@ impl Step for CodegenBackend {
13051305
return None;
13061306
}
13071307

1308+
if !builder.config.rust_codegen_backends.contains(&self.backend) {
1309+
return None;
1310+
}
1311+
13081312
if self.backend == "cranelift" {
13091313
if !target_supports_cranelift_backend(self.compiler.host) {
13101314
builder.info("target not supported by rustc_codegen_cranelift. skipping");
@@ -1343,12 +1347,15 @@ impl Step for CodegenBackend {
13431347
let backends_dst = PathBuf::from("lib").join(&backends_rel);
13441348

13451349
let backend_name = format!("rustc_codegen_{}", backend);
1350+
let mut found_backend = false;
13461351
for backend in fs::read_dir(&backends_src).unwrap() {
13471352
let file_name = backend.unwrap().file_name();
13481353
if file_name.to_str().unwrap().contains(&backend_name) {
13491354
tarball.add_file(backends_src.join(file_name), &backends_dst, 0o644);
1355+
found_backend = true;
13501356
}
13511357
}
1358+
assert!(found_backend);
13521359

13531360
Some(tarball.generate())
13541361
}

src/bootstrap/src/core/config/config.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1274,8 +1274,9 @@ impl Config {
12741274
}
12751275

12761276
config.initial_rustc = if let Some(rustc) = build.rustc {
1277-
// FIXME(#115065): re-enable this check
1278-
// config.check_build_rustc_version(&rustc);
1277+
if !flags.skip_stage0_validation {
1278+
config.check_build_rustc_version(&rustc);
1279+
}
12791280
PathBuf::from(rustc)
12801281
} else {
12811282
config.download_beta_toolchain();

src/bootstrap/src/core/config/flags.rs

+3
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,9 @@ pub struct Flags {
155155
/// Enable BOLT link flags
156156
#[arg(global(true), long)]
157157
pub enable_bolt_settings: bool,
158+
/// Skip stage0 compiler validation
159+
#[arg(global(true), long)]
160+
pub skip_stage0_validation: bool,
158161
/// Additional reproducible artifacts that should be added to the reproducible artifacts archive.
159162
#[arg(global(true), long)]
160163
pub reproducible_artifact: Vec<String>,

src/ci/docker/run.sh

+1
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@ docker \
288288
--env DIST_TRY_BUILD \
289289
--env PR_CI_JOB \
290290
--env OBJDIR_ON_HOST="$objdir" \
291+
--env CODEGEN_BACKENDS \
291292
--init \
292293
--rm \
293294
rust-ci \

0 commit comments

Comments
 (0)