diff options
| author | Dylan DPC <dylan.dpc@gmail.com> | 2020-02-26 15:34:32 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-02-26 15:34:32 +0100 |
| commit | d799f2deb10e98cab17439ad4f38204cc3dc406c (patch) | |
| tree | c6482eb8cc340951a26ebe84d5fdfbbc26013e7e /src/bootstrap | |
| parent | e028f26e1df27c257e5007390d1787a256b6eee7 (diff) | |
| parent | 4f15867faf2797257cbeb9e4a38ae8dc87dcf2e9 (diff) | |
| download | rust-d799f2deb10e98cab17439ad4f38204cc3dc406c.tar.gz rust-d799f2deb10e98cab17439ad4f38204cc3dc406c.zip | |
Rollup merge of #69381 - QuiltOS:no-std-from-config, r=Mark-Simulacrum
Allow getting `no_std` from the config file Currently, it is only set correctly in the sanity checking implicit default fallback code. Having a config file at all will for force `no_std = false`.
Diffstat (limited to 'src/bootstrap')
| -rw-r--r-- | src/bootstrap/config.rs | 15 | ||||
| -rw-r--r-- | src/bootstrap/sanity.rs | 9 |
2 files changed, 17 insertions, 7 deletions
diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index 214d572329e..746cddbabd6 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -177,6 +177,15 @@ pub struct Target { pub no_std: bool, } +impl Target { + pub fn from_triple(triple: &str) -> Self { + let mut target: Self = Default::default(); + if triple.contains("-none-") || triple.contains("nvptx") { + target.no_std = true; + } + target + } +} /// Structure of the `config.toml` file that configuration is read from. /// /// This structure uses `Decodable` to automatically decode a TOML configuration @@ -353,6 +362,7 @@ struct TomlTarget { musl_root: Option<String>, wasi_root: Option<String>, qemu_rootfs: Option<String>, + no_std: Option<bool>, } impl Config { @@ -595,7 +605,7 @@ impl Config { if let Some(ref t) = toml.target { for (triple, cfg) in t { - let mut target = Target::default(); + let mut target = Target::from_triple(triple); if let Some(ref s) = cfg.llvm_config { target.llvm_config = Some(config.src.join(s)); @@ -606,6 +616,9 @@ impl Config { if let Some(ref s) = cfg.android_ndk { target.ndk = Some(config.src.join(s)); } + if let Some(s) = cfg.no_std { + target.no_std = s; + } target.cc = cfg.cc.clone().map(PathBuf::from); target.cxx = cfg.cxx.clone().map(PathBuf::from); target.ar = cfg.ar.clone().map(PathBuf::from); diff --git a/src/bootstrap/sanity.rs b/src/bootstrap/sanity.rs index 8ff7056e628..530e74da8ca 100644 --- a/src/bootstrap/sanity.rs +++ b/src/bootstrap/sanity.rs @@ -17,6 +17,7 @@ use std::process::Command; use build_helper::{output, t}; +use crate::config::Target; use crate::Build; struct Finder { @@ -192,13 +193,9 @@ pub fn check(build: &mut Build) { panic!("the iOS target is only supported on macOS"); } - if target.contains("-none-") || target.contains("nvptx") { - if build.no_std(*target).is_none() { - let target = build.config.target_config.entry(target.clone()).or_default(); - - target.no_std = true; - } + build.config.target_config.entry(target.clone()).or_insert(Target::from_triple(target)); + if target.contains("-none-") || target.contains("nvptx") { if build.no_std(*target) == Some(false) { panic!("All the *-none-* and nvptx* targets are no-std targets") } |
