Skip to content

Commit 69c6aa5

Browse files
committed
Avoid infinite recursion when cranelift is the default codegen backend
1 parent 35453ac commit 69c6aa5

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

scripts/setup_rust_fork.sh

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ set -e
44
# Compiletest expects all standard library paths to start with /rustc/FAKE_PREFIX.
55
# CG_CLIF_STDLIB_REMAP_PATH_PREFIX will cause cg_clif's build system to pass
66
# --remap-path-prefix to handle this.
7-
CG_CLIF_STDLIB_REMAP_PATH_PREFIX=/rustc/FAKE_PREFIX ./y.sh build
7+
# CG_CLIF_FORCE_GNU_AS will force usage of as instead of the LLVM backend of rustc as we
8+
# the LLVM backend isn't compiled in here.
9+
CG_CLIF_FORCE_GNU_AS=1 CG_CLIF_STDLIB_REMAP_PATH_PREFIX=/rustc/FAKE_PREFIX ./y.sh build
810

911
echo "[SETUP] Rust fork"
1012
git clone https://github.com/rust-lang/rust.git || true

scripts/test_bootstrap.sh

+3-1
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,7 @@ rm -r compiler/rustc_codegen_cranelift/{Cargo.*,src}
1111
cp ../Cargo.* compiler/rustc_codegen_cranelift/
1212
cp -r ../src compiler/rustc_codegen_cranelift/src
1313

14-
./x.py build --stage 1 library/std
14+
# CG_CLIF_FORCE_GNU_AS will force usage of as instead of the LLVM backend of rustc as we
15+
# the LLVM backend isn't compiled in here.
16+
CG_CLIF_FORCE_GNU_AS=1 ./x.py build --stage 1 library/std
1517
popd

src/global_asm.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ pub(crate) fn compile_global_asm(
140140
);
141141

142142
// Assemble `global_asm`
143-
if false {
143+
if option_env!("CG_CLIF_FORCE_GNU_AS").is_some() {
144144
let mut child = Command::new(&config.assembler)
145145
.arg("-o")
146146
.arg(&global_asm_object_file)
@@ -164,6 +164,7 @@ pub(crate) fn compile_global_asm(
164164
.arg(&global_asm_object_file)
165165
.arg("-")
166166
.arg("-Abad_asm_style")
167+
.arg("-Zcodegen-backend=llvm")
167168
.stdin(Stdio::piped())
168169
.spawn()
169170
.expect("Failed to spawn `as`.");

0 commit comments

Comments
 (0)