Avoid the hexagon backend on old versions of LLVM
This commit is contained in:
parent
c558a2ae37
commit
32aeb22f54
1 changed files with 38 additions and 28 deletions
|
@ -17,13 +17,8 @@ use std::path::{PathBuf, Path};
|
||||||
|
|
||||||
use build_helper::output;
|
use build_helper::output;
|
||||||
|
|
||||||
fn detect_llvm_link(llvm_config: &Path) -> (&'static str, Option<&'static str>) {
|
fn detect_llvm_link(major: u32, minor: u32, llvm_config: &Path)
|
||||||
let mut version_cmd = Command::new(llvm_config);
|
-> (&'static str, Option<&'static str>) {
|
||||||
version_cmd.arg("--version");
|
|
||||||
let version_output = output(&mut version_cmd);
|
|
||||||
let mut parts = version_output.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) {
|
if major > 3 || (major == 3 && minor >= 9) {
|
||||||
// Force the link mode we want, preferring static by default, but
|
// Force the link mode we want, preferring static by default, but
|
||||||
// possibly overridden by `configure --enable-llvm-link-shared`.
|
// possibly overridden by `configure --enable-llvm-link-shared`.
|
||||||
|
@ -42,7 +37,6 @@ fn detect_llvm_link(llvm_config: &Path) -> (&'static str, Option<&'static str>)
|
||||||
return ("static", None);
|
return ("static", None);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
("static", None)
|
("static", None)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,9 +86,25 @@ fn main() {
|
||||||
let host = env::var("HOST").expect("HOST was not set");
|
let host = env::var("HOST").expect("HOST was not set");
|
||||||
let is_crossed = target != host;
|
let is_crossed = target != host;
|
||||||
|
|
||||||
let optional_components =
|
let mut optional_components =
|
||||||
["x86", "arm", "aarch64", "mips", "powerpc", "pnacl", "systemz", "jsbackend", "msp430",
|
vec!["x86", "arm", "aarch64", "mips", "powerpc", "pnacl",
|
||||||
"sparc", "nvptx", "hexagon"];
|
"systemz", "jsbackend", "msp430", "sparc", "nvptx"];
|
||||||
|
|
||||||
|
let mut version_cmd = Command::new(&llvm_config);
|
||||||
|
version_cmd.arg("--version");
|
||||||
|
let version_output = output(&mut version_cmd);
|
||||||
|
let mut parts = version_output.split('.').take(2)
|
||||||
|
.filter_map(|s| s.parse::<u32>().ok());
|
||||||
|
let (major, minor) =
|
||||||
|
if let (Some(major), Some(minor)) = (parts.next(), parts.next()) {
|
||||||
|
(major, minor)
|
||||||
|
} else {
|
||||||
|
(3, 7)
|
||||||
|
};
|
||||||
|
|
||||||
|
if major > 3 {
|
||||||
|
optional_components.push("hexagon");
|
||||||
|
}
|
||||||
|
|
||||||
// FIXME: surely we don't need all these components, right? Stuff like mcjit
|
// FIXME: surely we don't need all these components, right? Stuff like mcjit
|
||||||
// or interpreter the compiler itself never uses.
|
// or interpreter the compiler itself never uses.
|
||||||
|
@ -158,7 +168,7 @@ fn main() {
|
||||||
.cpp_link_stdlib(None) // we handle this below
|
.cpp_link_stdlib(None) // we handle this below
|
||||||
.compile("librustllvm.a");
|
.compile("librustllvm.a");
|
||||||
|
|
||||||
let (llvm_kind, llvm_link_arg) = detect_llvm_link(&llvm_config);
|
let (llvm_kind, llvm_link_arg) = detect_llvm_link(major, minor, &llvm_config);
|
||||||
|
|
||||||
// Link in all LLVM libraries, if we're uwring the "wrong" llvm-config then
|
// Link in all LLVM libraries, if we're uwring the "wrong" llvm-config then
|
||||||
// we don't pick up system libs because unfortunately they're for the host
|
// we don't pick up system libs because unfortunately they're for the host
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue