diff options
| author | The Miri Cronjob Bot <miri@cron.bot> | 2024-11-22 05:28:46 +0000 |
|---|---|---|
| committer | The Miri Cronjob Bot <miri@cron.bot> | 2024-11-22 05:28:46 +0000 |
| commit | 69930dc963440be5b39270edfd9205366283be00 (patch) | |
| tree | 7dca9b78a36bdd145ff388005efdd00bd51ebc8c /src | |
| parent | f77817a701c291b94fe6da25c4865bc50a8fcb1d (diff) | |
| parent | 46cd0c526691f485365e57228c99db8f7c16c324 (diff) | |
| download | rust-69930dc963440be5b39270edfd9205366283be00.tar.gz rust-69930dc963440be5b39270edfd9205366283be00.zip | |
Merge from rustc
Diffstat (limited to 'src')
| -rw-r--r-- | src/bootstrap/src/core/build_steps/compile.rs | 8 | ||||
| -rw-r--r-- | src/bootstrap/src/core/build_steps/dist.rs | 11 | ||||
| -rw-r--r-- | src/bootstrap/src/core/build_steps/test.rs | 3 | ||||
| -rw-r--r-- | src/bootstrap/src/utils/helpers.rs | 24 | ||||
| -rwxr-xr-x | src/ci/run.sh | 2 | ||||
| -rw-r--r-- | src/doc/unstable-book/src/language-features/asm-goto.md | 4 | ||||
| m--------- | src/llvm-project | 0 | ||||
| -rw-r--r-- | src/tools/rustfmt/src/macros.rs | 2 |
8 files changed, 36 insertions, 18 deletions
diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs index 24be705f481..8e088682f92 100644 --- a/src/bootstrap/src/core/build_steps/compile.rs +++ b/src/bootstrap/src/core/build_steps/compile.rs @@ -1457,7 +1457,7 @@ impl Step for CodegenBackend { } let mut files = files.into_iter().filter(|f| { let filename = f.file_name().unwrap().to_str().unwrap(); - is_dylib(filename) && filename.contains("rustc_codegen_") + is_dylib(f) && filename.contains("rustc_codegen_") }); let codegen_backend = match files.next() { Some(f) => f, @@ -1936,7 +1936,7 @@ impl Step for Assemble { let filename = f.file_name().into_string().unwrap(); let is_proc_macro = proc_macros.contains(&filename); - let is_dylib_or_debug = is_dylib(&filename) || is_debug_info(&filename); + let is_dylib_or_debug = is_dylib(&f.path()) || is_debug_info(&filename); // If we link statically to stdlib, do not copy the libstd dynamic library file // FIXME: Also do this for Windows once incremental post-optimization stage0 tests @@ -2089,7 +2089,7 @@ pub fn run_cargo( if filename.ends_with(".lib") || filename.ends_with(".a") || is_debug_info(&filename) - || is_dylib(&filename) + || is_dylib(Path::new(&*filename)) { // Always keep native libraries, rust dylibs and debuginfo keep = true; @@ -2189,7 +2189,7 @@ pub fn run_cargo( Some(triple) => triple.0.to_str().unwrap(), None => panic!("no output generated for {prefix:?} {extension:?}"), }; - if is_dylib(path_to_add) { + if is_dylib(Path::new(path_to_add)) { let candidate = format!("{path_to_add}.lib"); let candidate = PathBuf::from(candidate); if candidate.exists() { diff --git a/src/bootstrap/src/core/build_steps/dist.rs b/src/bootstrap/src/core/build_steps/dist.rs index c022285211f..0216ac81162 100644 --- a/src/bootstrap/src/core/build_steps/dist.rs +++ b/src/bootstrap/src/core/build_steps/dist.rs @@ -436,13 +436,10 @@ impl Step for Rustc { if libdir_relative.to_str() != Some("bin") { let libdir = builder.rustc_libdir(compiler); for entry in builder.read_dir(&libdir) { - let name = entry.file_name(); - if let Some(s) = name.to_str() { - if is_dylib(s) { - // Don't use custom libdir here because ^lib/ will be resolved again - // with installer - builder.install(&entry.path(), &image.join("lib"), 0o644); - } + if is_dylib(&entry.path()) { + // Don't use custom libdir here because ^lib/ will be resolved again + // with installer + builder.install(&entry.path(), &image.join("lib"), 0o644); } } } diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs index 532c8f767eb..dcea9f5f7d1 100644 --- a/src/bootstrap/src/core/build_steps/test.rs +++ b/src/bootstrap/src/core/build_steps/test.rs @@ -2949,8 +2949,7 @@ impl Step for RemoteCopyLibs { // Push all our dylibs to the emulator for f in t!(builder.sysroot_target_libdir(compiler, target).read_dir()) { let f = t!(f); - let name = f.file_name().into_string().unwrap(); - if helpers::is_dylib(&name) { + if helpers::is_dylib(&f.path()) { command(&tool).arg("push").arg(f.path()).run(builder); } } diff --git a/src/bootstrap/src/utils/helpers.rs b/src/bootstrap/src/utils/helpers.rs index 3fb2330469a..9ca036a2afd 100644 --- a/src/bootstrap/src/utils/helpers.rs +++ b/src/bootstrap/src/utils/helpers.rs @@ -11,6 +11,7 @@ use std::time::{Instant, SystemTime, UNIX_EPOCH}; use std::{env, fs, io, str}; use build_helper::util::fail; +use object::read::archive::ArchiveFile; use crate::LldMode; use crate::core::builder::Builder; @@ -53,8 +54,27 @@ pub fn exe(name: &str, target: TargetSelection) -> String { } /// Returns `true` if the file name given looks like a dynamic library. -pub fn is_dylib(name: &str) -> bool { - name.ends_with(".dylib") || name.ends_with(".so") || name.ends_with(".dll") +pub fn is_dylib(path: &Path) -> bool { + path.extension().and_then(|ext| ext.to_str()).map_or(false, |ext| { + ext == "dylib" || ext == "so" || ext == "dll" || (ext == "a" && is_aix_shared_archive(path)) + }) +} + +fn is_aix_shared_archive(path: &Path) -> bool { + // FIXME(#133268): reading the entire file as &[u8] into memory seems excessive + // look into either mmap it or use the ReadCache + let data = match fs::read(path) { + Ok(data) => data, + Err(_) => return false, + }; + let file = match ArchiveFile::parse(&*data) { + Ok(file) => file, + Err(_) => return false, + }; + + file.members() + .filter_map(Result::ok) + .any(|entry| String::from_utf8_lossy(entry.name()).contains(".so")) } /// Returns `true` if the file name given looks like a debug info file diff --git a/src/ci/run.sh b/src/ci/run.sh index 5690d8edea6..b874f71832d 100755 --- a/src/ci/run.sh +++ b/src/ci/run.sh @@ -116,7 +116,7 @@ if [ "$DEPLOY$DEPLOY_ALT" = "1" ]; then RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --enable-llvm-static-stdcpp" RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --set rust.remap-debuginfo" - if [ "$DEPLOY_ALT" != "" ]; then + if [ "$DEPLOY_ALT" != "" ] && isLinux; then RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --debuginfo-level=2" else RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --debuginfo-level-std=1" diff --git a/src/doc/unstable-book/src/language-features/asm-goto.md b/src/doc/unstable-book/src/language-features/asm-goto.md index d72eb7c0c6e..823118bcae1 100644 --- a/src/doc/unstable-book/src/language-features/asm-goto.md +++ b/src/doc/unstable-book/src/language-features/asm-goto.md @@ -21,7 +21,9 @@ unsafe { } ``` -The block must have unit type or diverge. +The block must have unit type or diverge. The block starts a new safety context, +so despite outer `unsafe`, you need extra unsafe to perform unsafe operations +within `label <block>`. When `label <block>` is used together with `noreturn` option, it means that the assembly will not fallthrough. It's allowed to jump to a label within the diff --git a/src/llvm-project b/src/llvm-project -Subproject b35599be758613448201a49f4b8c7ebfba5558a +Subproject 104d0d16c3c7c3fef2435fef6efb2d57b70fff7 diff --git a/src/tools/rustfmt/src/macros.rs b/src/tools/rustfmt/src/macros.rs index 5a35e115d8f..4083d9398f6 100644 --- a/src/tools/rustfmt/src/macros.rs +++ b/src/tools/rustfmt/src/macros.rs @@ -620,7 +620,7 @@ fn delim_token_to_str( ("{ ", " }") } } - Delimiter::Invisible => unreachable!(), + Delimiter::Invisible(_) => unreachable!(), }; if use_multiple_lines { let indent_str = shape.indent.to_string_with_newline(context.config); |
