make optimized-compiler-builtins target configurable
Signed-off-by: onur-ozkan <work@onurozkan.dev>
This commit is contained in:
parent
6afee111c2
commit
4fd82f72ec
2 changed files with 11 additions and 1 deletions
|
|
@ -469,7 +469,7 @@ pub fn std_cargo(builder: &Builder<'_>, target: TargetSelection, stage: u32, car
|
|||
// If `compiler-rt` is available ensure that the `c` feature of the
|
||||
// `compiler-builtins` crate is enabled and it's configured to learn where
|
||||
// `compiler-rt` is located.
|
||||
let compiler_builtins_c_feature = if builder.config.optimized_compiler_builtins {
|
||||
let compiler_builtins_c_feature = if builder.config.optimized_compiler_builtins(target) {
|
||||
// NOTE: this interacts strangely with `llvm-has-rust-patches`. In that case, we enforce `submodules = false`, so this is a no-op.
|
||||
// But, the user could still decide to manually use an in-tree submodule.
|
||||
//
|
||||
|
|
|
|||
|
|
@ -634,6 +634,7 @@ pub struct Target {
|
|||
pub runner: Option<String>,
|
||||
pub no_std: bool,
|
||||
pub codegen_backends: Option<Vec<String>>,
|
||||
pub optimized_compiler_builtins: Option<bool>,
|
||||
}
|
||||
|
||||
impl Target {
|
||||
|
|
@ -1219,6 +1220,7 @@ define_config! {
|
|||
no_std: Option<bool> = "no-std",
|
||||
codegen_backends: Option<Vec<String>> = "codegen-backends",
|
||||
runner: Option<String> = "runner",
|
||||
optimized_compiler_builtins: Option<bool> = "optimized-compiler-builtins",
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2096,6 +2098,7 @@ impl Config {
|
|||
target.sanitizers = cfg.sanitizers;
|
||||
target.profiler = cfg.profiler;
|
||||
target.rpath = cfg.rpath;
|
||||
target.optimized_compiler_builtins = cfg.optimized_compiler_builtins;
|
||||
|
||||
if let Some(ref backends) = cfg.codegen_backends {
|
||||
let available_backends = ["llvm", "cranelift", "gcc"];
|
||||
|
|
@ -2609,6 +2612,13 @@ impl Config {
|
|||
self.target_config.get(&target).and_then(|t| t.rpath).unwrap_or(self.rust_rpath)
|
||||
}
|
||||
|
||||
pub fn optimized_compiler_builtins(&self, target: TargetSelection) -> bool {
|
||||
self.target_config
|
||||
.get(&target)
|
||||
.and_then(|t| t.optimized_compiler_builtins)
|
||||
.unwrap_or(self.optimized_compiler_builtins)
|
||||
}
|
||||
|
||||
pub fn llvm_enabled(&self, target: TargetSelection) -> bool {
|
||||
self.codegen_backends(target).contains(&"llvm".to_owned())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue