# If an external LLVM root is specified, we automatically check the version by
# default to make sure it's within the range that we're expecting, but setting
# this flag will indicate that this version check should not be done.
-#version-check = false
+#version-check = true
# Link libstdc++ statically into the librustc_llvm instead of relying on a
# dynamic version to be available.
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;
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)]