about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorJosh Stone <jistone@redhat.com>2017-10-16 12:57:37 -0700
committerJosh Stone <jistone@redhat.com>2017-10-16 13:10:16 -0700
commit6f33108e4d13c018368fb7fd3c337718de89925e (patch)
tree505427b3f941d3980b989632dee0a3c0d41f414d /src/bootstrap
parent7538a9b8afc42abfdc01afb4481a63dc3840f2ee (diff)
downloadrust-6f33108e4d13c018368fb7fd3c337718de89925e.tar.gz
rust-6f33108e4d13c018368fb7fd3c337718de89925e.zip
bootstrap: update and enable the LLVM version-check
While the `config.toml.example` comments say "we automatically check the
version by default," we actually didn't.  That check was badly out of
date, only allowing 3.5, 3.6, or 3.7.  This it now updated to the new
3.9 minimum requirement, and truly enabled by default.
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/config.rs1
-rw-r--r--src/bootstrap/native.rs11
2 files changed, 8 insertions, 4 deletions
diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs
index 69e0f58f1cd..d6c83e3acfc 100644
--- a/src/bootstrap/config.rs
+++ b/src/bootstrap/config.rs
@@ -299,6 +299,7 @@ impl Config {
         let mut config = Config::default();
         config.llvm_enabled = true;
         config.llvm_optimize = true;
+        config.llvm_version_check = true;
         config.use_jemalloc = true;
         config.backtrace = true;
         config.rust_optimize = true;
diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs
index 941ea96bbec..c37b1dad4c6 100644
--- a/src/bootstrap/native.rs
+++ b/src/bootstrap/native.rs
@@ -259,11 +259,14 @@ fn check_llvm_version(build: &Build, llvm_config: &Path) {
 
     let mut cmd = Command::new(llvm_config);
     let version = output(cmd.arg("--version"));
-    if version.starts_with("3.5") || version.starts_with("3.6") ||
-       version.starts_with("3.7") {
-        return
+    let mut parts = version.split('.').take(2)
+        .filter_map(|s| s.parse::<u32>().ok());
+    if let (Some(major), Some(minor)) = (parts.next(), parts.next()) {
+        if major > 3 || (major == 3 && minor >= 9) {
+            return
+        }
     }
-    panic!("\n\nbad LLVM version: {}, need >=3.5\n\n", version)
+    panic!("\n\nbad LLVM version: {}, need >=3.9\n\n", version)
 }
 
 #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]