Skip to content

Allow cross-compiling the Cranelift dist component #145320

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/bootstrap/src/core/build_steps/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1410,6 +1410,7 @@ impl Step for Miri {
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
pub struct CraneliftCodegenBackend {
pub build_compiler: Compiler,
pub target: TargetSelection,
}

impl Step for CraneliftCodegenBackend {
Expand Down Expand Up @@ -1437,6 +1438,7 @@ impl Step for CraneliftCodegenBackend {
run.builder.config.host_target,
run.target,
),
target: run.target,
});
}

Expand All @@ -1448,7 +1450,7 @@ impl Step for CraneliftCodegenBackend {
return None;
}

let target = self.build_compiler.host;
let target = self.target;
let compilers =
RustcPrivateCompilers::from_build_compiler(builder, self.build_compiler, target);
if !target_supports_cranelift_backend(target) {
Expand Down Expand Up @@ -1608,6 +1610,7 @@ impl Step for Extended {
add_component!("analysis" => Analysis { compiler, target });
add_component!("rustc-codegen-cranelift" => CraneliftCodegenBackend {
build_compiler: compiler,
target
});
add_component!("llvm-bitcode-linker" => LlvmBitcodeLinker {
build_compiler: compiler,
Expand Down
1 change: 1 addition & 0 deletions src/bootstrap/src/core/build_steps/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ install!((self, builder, _config),
RustcCodegenCranelift, alias = "rustc-codegen-cranelift", Self::should_build(_config), only_hosts: true, {
if let Some(tarball) = builder.ensure(dist::CraneliftCodegenBackend {
build_compiler: self.compiler,
target: self.target
}) {
install_sh(builder, "rustc-codegen-cranelift", self.compiler.stage, Some(self.target), &tarball);
} else {
Expand Down
Loading