summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_codegen_cranelift/scripts
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:59:24 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:59:24 +0000
commit023939b627b7dc93b01471f7d41fb8553ddb4ffa (patch)
tree60fc59477c605c72b0a1051409062ddecc43f877 /compiler/rustc_codegen_cranelift/scripts
parentAdding debian version 1.72.1+dfsg1-1. (diff)
downloadrustc-023939b627b7dc93b01471f7d41fb8553ddb4ffa.tar.xz
rustc-023939b627b7dc93b01471f7d41fb8553ddb4ffa.zip
Merging upstream version 1.73.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'compiler/rustc_codegen_cranelift/scripts')
-rw-r--r--compiler/rustc_codegen_cranelift/scripts/cargo-clif.rs80
-rw-r--r--compiler/rustc_codegen_cranelift/scripts/setup_rust_fork.sh5
-rwxr-xr-xcompiler/rustc_codegen_cranelift/scripts/test_rustc_tests.sh14
3 files changed, 63 insertions, 36 deletions
diff --git a/compiler/rustc_codegen_cranelift/scripts/cargo-clif.rs b/compiler/rustc_codegen_cranelift/scripts/cargo-clif.rs
index 99b97be24..1e14f41d4 100644
--- a/compiler/rustc_codegen_cranelift/scripts/cargo-clif.rs
+++ b/compiler/rustc_codegen_cranelift/scripts/cargo-clif.rs
@@ -3,6 +3,8 @@ use std::env;
use std::os::unix::process::CommandExt;
use std::process::Command;
+include!("../build_system/shared_utils.rs");
+
fn main() {
let current_exe = env::current_exe().unwrap();
let mut sysroot = current_exe.parent().unwrap();
@@ -10,27 +12,19 @@ fn main() {
sysroot = sysroot.parent().unwrap();
}
- let mut rustflags = String::new();
- rustflags.push_str(" -Cpanic=abort -Zpanic-abort-tests -Zcodegen-backend=");
+ let mut rustflags = vec!["-Cpanic=abort".to_owned(), "-Zpanic-abort-tests".to_owned()];
if let Some(name) = option_env!("BUILTIN_BACKEND") {
- rustflags.push_str(name);
+ rustflags.push(format!("-Zcodegen-backend={name}"));
} else {
- rustflags.push_str(
- sysroot
- .join(if cfg!(windows) { "bin" } else { "lib" })
- .join(
- env::consts::DLL_PREFIX.to_string()
- + "rustc_codegen_cranelift"
- + env::consts::DLL_SUFFIX,
- )
- .to_str()
- .unwrap(),
+ let dylib = sysroot.join(if cfg!(windows) { "bin" } else { "lib" }).join(
+ env::consts::DLL_PREFIX.to_string()
+ + "rustc_codegen_cranelift"
+ + env::consts::DLL_SUFFIX,
);
+ rustflags.push(format!("-Zcodegen-backend={}", dylib.to_str().unwrap()));
}
- rustflags.push_str(" --sysroot ");
- rustflags.push_str(sysroot.to_str().unwrap());
- env::set_var("RUSTFLAGS", env::var("RUSTFLAGS").unwrap_or(String::new()) + &rustflags);
- env::set_var("RUSTDOCFLAGS", env::var("RUSTDOCFLAGS").unwrap_or(String::new()) + &rustflags);
+ rustflags.push("--sysroot".to_owned());
+ rustflags.push(sysroot.to_str().unwrap().to_owned());
let cargo = if let Some(cargo) = option_env!("CARGO") {
cargo
@@ -40,14 +34,19 @@ fn main() {
"cargo"
};
- let args: Vec<_> = match env::args().nth(1).as_deref() {
+ let mut args = env::args().skip(1).collect::<Vec<_>>();
+ if args.get(0).map(|arg| &**arg) == Some("clif") {
+ // Avoid infinite recursion when invoking `cargo-clif` as cargo subcommand using
+ // `cargo clif`.
+ args.remove(0);
+ }
+
+ let args: Vec<_> = match args.get(0).map(|arg| &**arg) {
Some("jit") => {
- env::set_var(
- "RUSTFLAGS",
- env::var("RUSTFLAGS").unwrap_or(String::new()) + " -Cprefer-dynamic",
- );
+ rustflags.push("-Cprefer-dynamic".to_owned());
+ args.remove(0);
IntoIterator::into_iter(["rustc".to_string()])
- .chain(env::args().skip(2))
+ .chain(args)
.chain([
"--".to_string(),
"-Zunstable-options".to_string(),
@@ -56,12 +55,10 @@ fn main() {
.collect()
}
Some("lazy-jit") => {
- env::set_var(
- "RUSTFLAGS",
- env::var("RUSTFLAGS").unwrap_or(String::new()) + " -Cprefer-dynamic",
- );
+ rustflags.push("-Cprefer-dynamic".to_owned());
+ args.remove(0);
IntoIterator::into_iter(["rustc".to_string()])
- .chain(env::args().skip(2))
+ .chain(args)
.chain([
"--".to_string(),
"-Zunstable-options".to_string(),
@@ -69,14 +66,31 @@ fn main() {
])
.collect()
}
- _ => env::args().skip(1).collect(),
+ _ => args,
};
+ let mut cmd = Command::new(cargo);
+ cmd.args(args);
+ rustflags_to_cmd_env(
+ &mut cmd,
+ "RUSTFLAGS",
+ &rustflags_from_env("RUSTFLAGS")
+ .into_iter()
+ .chain(rustflags.iter().map(|flag| flag.clone()))
+ .collect::<Vec<_>>(),
+ );
+ rustflags_to_cmd_env(
+ &mut cmd,
+ "RUSTDOCFLAGS",
+ &rustflags_from_env("RUSTDOCFLAGS")
+ .into_iter()
+ .chain(rustflags.iter().map(|flag| flag.clone()))
+ .collect::<Vec<_>>(),
+ );
+
#[cfg(unix)]
- panic!("Failed to spawn cargo: {}", Command::new(cargo).args(args).exec());
+ panic!("Failed to spawn cargo: {}", cmd.exec());
#[cfg(not(unix))]
- std::process::exit(
- Command::new(cargo).args(args).spawn().unwrap().wait().unwrap().code().unwrap_or(1),
- );
+ std::process::exit(cmd.spawn().unwrap().wait().unwrap().code().unwrap_or(1));
}
diff --git a/compiler/rustc_codegen_cranelift/scripts/setup_rust_fork.sh b/compiler/rustc_codegen_cranelift/scripts/setup_rust_fork.sh
index 15b16b42b..e6bbac647 100644
--- a/compiler/rustc_codegen_cranelift/scripts/setup_rust_fork.sh
+++ b/compiler/rustc_codegen_cranelift/scripts/setup_rust_fork.sh
@@ -10,7 +10,8 @@ git fetch
git checkout -- .
git checkout "$(rustc -V | cut -d' ' -f3 | tr -d '(')"
-git -c user.name=Dummy -c user.email=dummy@example.com am ../patches/*-stdlib-*.patch
+git -c user.name=Dummy -c user.email=dummy@example.com -c commit.gpgSign=false \
+ am ../patches/*-stdlib-*.patch
git apply - <<EOF
diff --git a/library/alloc/Cargo.toml b/library/alloc/Cargo.toml
@@ -51,7 +52,7 @@ popd
# FIXME remove once inline asm is fully supported
export RUSTFLAGS="$RUSTFLAGS --cfg=rustix_use_libc"
-export CFG_VIRTUAL_RUST_SOURCE_BASE_DIR="$(cd download/sysroot/sysroot_src; pwd)"
+export CFG_VIRTUAL_RUST_SOURCE_BASE_DIR="$(cd build/stdlib; pwd)"
# Allow the testsuite to use llvm tools
host_triple=$(rustc -vV | grep host | cut -d: -f2 | tr -d " ")
diff --git a/compiler/rustc_codegen_cranelift/scripts/test_rustc_tests.sh b/compiler/rustc_codegen_cranelift/scripts/test_rustc_tests.sh
index a7920cc54..c163b8543 100755
--- a/compiler/rustc_codegen_cranelift/scripts/test_rustc_tests.sh
+++ b/compiler/rustc_codegen_cranelift/scripts/test_rustc_tests.sh
@@ -32,6 +32,8 @@ rm tests/ui/parser/unclosed-delimiter-in-dep.rs # submodule contains //~ERROR
# missing features
# ================
+rm -r tests/run-make/comment-section # cg_clif doesn't yet write the .comment section
+
# requires stack unwinding
# FIXME add needs-unwind to this test
rm -r tests/run-make/libtest-junit
@@ -47,6 +49,8 @@ rm tests/ui/proc-macro/allowed-signatures.rs
# vendor intrinsics
rm tests/ui/sse2.rs # cpuid not supported, so sse2 not detected
rm tests/ui/simd/array-type.rs # "Index argument for `simd_insert` is not a constant"
+rm tests/ui/simd/intrinsic/generic-bswap-byte.rs # simd_bswap not yet implemented
+rm tests/ui/simd/intrinsic/generic-arithmetic-pass.rs # many missing simd intrinsics
# exotic linkages
rm tests/ui/issues/issue-33992.rs # unsupported linkages
@@ -98,8 +102,11 @@ rm -r tests/run-make/sepcomp-inlining # same
rm -r tests/run-make/sepcomp-separate # same
rm -r tests/run-make/sepcomp-cci-copies # same
rm -r tests/run-make/volatile-intrinsics # same
+rm -r tests/run-make/llvm-ident # same
+rm -r tests/run-make/no-builtins-attribute # same
rm tests/ui/abi/stack-protector.rs # requires stack protector support
rm -r tests/run-make/emit-stack-sizes # requires support for -Z emit-stack-sizes
+rm -r tests/run-make/optimization-remarks-dir # remarks are LLVM specific
# giving different but possibly correct results
# =============================================
@@ -118,6 +125,9 @@ rm tests/ui/suggestions/derive-trait-for-method-call.rs # same
rm tests/ui/typeck/issue-46112.rs # same
rm tests/ui/consts/const_cmp_type_id.rs # same
rm tests/ui/consts/issue-73976-monomorphic.rs # same
+rm tests/ui/rfcs/rfc-3348-c-string-literals/non-ascii.rs # same
+rm tests/ui/consts/const-eval/nonnull_as_ref_ub.rs # same
+rm tests/ui/consts/issue-94675.rs # same
# rustdoc-clif passes extra args, suppressing the help message when no args are passed
rm -r tests/run-make/issue-88756-default-output
@@ -143,6 +153,8 @@ rm -r tests/run-make/used # same
rm -r tests/run-make/no-alloc-shim
rm -r tests/run-make/emit-to-stdout
+rm -r tests/run-make/extern-fn-explicit-align # argument alignment not yet supported
+
# bugs in the test suite
# ======================
rm tests/ui/backtrace.rs # TODO warning
@@ -162,7 +174,7 @@ index ea06b620c4c..b969d0009c6 100644
@@ -9,7 +9,7 @@ RUSTC_ORIGINAL := \$(RUSTC)
BARE_RUSTC := \$(HOST_RPATH_ENV) '\$(RUSTC)'
BARE_RUSTDOC := \$(HOST_RPATH_ENV) '\$(RUSTDOC)'
- RUSTC := \$(BARE_RUSTC) --out-dir \$(TMPDIR) -L \$(TMPDIR) \$(RUSTFLAGS)
+ RUSTC := \$(BARE_RUSTC) --out-dir \$(TMPDIR) -L \$(TMPDIR) \$(RUSTFLAGS) -Ainternal_features
-RUSTDOC := \$(BARE_RUSTDOC) -L \$(TARGET_RPATH_DIR)
+RUSTDOC := \$(BARE_RUSTDOC)
ifdef RUSTC_LINKER