From 69c6aa560cfc1991822fdab1579153f6a25c392f Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Sun, 29 Oct 2023 18:53:38 +0000 Subject: [PATCH] Avoid infinite recursion when cranelift is the default codegen backend --- scripts/setup_rust_fork.sh | 4 +++- scripts/test_bootstrap.sh | 4 +++- src/global_asm.rs | 3 ++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/scripts/setup_rust_fork.sh b/scripts/setup_rust_fork.sh index 3e48fb006de..bbb8a010d96 100644 --- a/scripts/setup_rust_fork.sh +++ b/scripts/setup_rust_fork.sh @@ -4,7 +4,9 @@ set -e # Compiletest expects all standard library paths to start with /rustc/FAKE_PREFIX. # CG_CLIF_STDLIB_REMAP_PATH_PREFIX will cause cg_clif's build system to pass # --remap-path-prefix to handle this. -CG_CLIF_STDLIB_REMAP_PATH_PREFIX=/rustc/FAKE_PREFIX ./y.sh build +# CG_CLIF_FORCE_GNU_AS will force usage of as instead of the LLVM backend of rustc as we +# the LLVM backend isn't compiled in here. +CG_CLIF_FORCE_GNU_AS=1 CG_CLIF_STDLIB_REMAP_PATH_PREFIX=/rustc/FAKE_PREFIX ./y.sh build echo "[SETUP] Rust fork" git clone https://github.com/rust-lang/rust.git || true diff --git a/scripts/test_bootstrap.sh b/scripts/test_bootstrap.sh index 791d457993d..a8f6d7a2024 100755 --- a/scripts/test_bootstrap.sh +++ b/scripts/test_bootstrap.sh @@ -11,5 +11,7 @@ rm -r compiler/rustc_codegen_cranelift/{Cargo.*,src} cp ../Cargo.* compiler/rustc_codegen_cranelift/ cp -r ../src compiler/rustc_codegen_cranelift/src -./x.py build --stage 1 library/std +# CG_CLIF_FORCE_GNU_AS will force usage of as instead of the LLVM backend of rustc as we +# the LLVM backend isn't compiled in here. +CG_CLIF_FORCE_GNU_AS=1 ./x.py build --stage 1 library/std popd diff --git a/src/global_asm.rs b/src/global_asm.rs index 332a7ca9bf2..b14007f4e52 100644 --- a/src/global_asm.rs +++ b/src/global_asm.rs @@ -140,7 +140,7 @@ pub(crate) fn compile_global_asm( ); // Assemble `global_asm` - if false { + if option_env!("CG_CLIF_FORCE_GNU_AS").is_some() { let mut child = Command::new(&config.assembler) .arg("-o") .arg(&global_asm_object_file) @@ -164,6 +164,7 @@ pub(crate) fn compile_global_asm( .arg(&global_asm_object_file) .arg("-") .arg("-Abad_asm_style") + .arg("-Zcodegen-backend=llvm") .stdin(Stdio::piped()) .spawn() .expect("Failed to spawn `as`.");