Skip to content

Bootstrap ignores unknown values for codegen-backends #142184

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

Open
GrigorenkoPV opened this issue Jun 7, 2025 · 1 comment · May be fixed by #142212
Open

Bootstrap ignores unknown values for codegen-backends #142184

GrigorenkoPV opened this issue Jun 7, 2025 · 1 comment · May be fixed by #142212
Labels
C-bug Category: This is a bug. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Comments

@GrigorenkoPV
Copy link
Contributor

if let Some(ref backends) = codegen_backends {
let available_backends = ["llvm", "cranelift", "gcc"];
self.rust_codegen_backends = backends.iter().map(|s| {
if let Some(backend) = s.strip_prefix(CODEGEN_BACKEND_PREFIX) {
if available_backends.contains(&backend) {
panic!("Invalid value '{s}' for 'rust.codegen-backends'. Instead, please use '{backend}'.");
} else {
println!("HELP: '{s}' for 'rust.codegen-backends' might fail. \
Codegen backends are mostly defined without the '{CODEGEN_BACKEND_PREFIX}' prefix. \
In this case, it would be referred to as '{backend}'.");
}
}
s.clone()
}).collect();
}

If the value does not start with CODEGEN_BACKEND_PREFIX, it is just not validated at all.

So it means that typing gccc instead of gcc will cause no warning or error to be shown and gcc backend not actually being enabled.

Same issue for target-specific codegen options.

@GrigorenkoPV GrigorenkoPV added T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) C-bug Category: This is a bug. labels Jun 7, 2025
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jun 7, 2025
@Noratrieb Noratrieb removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jun 8, 2025
@bjorn3
Copy link
Member

bjorn3 commented Jun 8, 2025

The stripping there should probably just be removed. bootstrap.example.toml doesn't include the rustc_codegen_ prefix either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants