Check for the presence of clang frontends. (#1158)
* checks the presence of clang frontends. close GH-1149. * fix clippy complaints
This commit is contained in:
parent
d6ee2dbe12
commit
fd95560512
@ -205,6 +205,22 @@ pub const LIBAFL_CC_LLVM_VERSION: Option<usize> = None;
|
||||
return;
|
||||
}
|
||||
|
||||
let llvm_bindir = exec_llvm_config(&["--bindir"]);
|
||||
let bindir_path = Path::new(&llvm_bindir);
|
||||
|
||||
let clang = bindir_path.join("clang");
|
||||
let clangcpp = bindir_path.join("clang++");
|
||||
|
||||
if !clang.exists() {
|
||||
println!("cargo:warning=Failed to find clang frontend.");
|
||||
return;
|
||||
}
|
||||
|
||||
if !clangcpp.exists() {
|
||||
println!("cargo:warning=Failed to find clang++ frontend.");
|
||||
return;
|
||||
}
|
||||
|
||||
let cxxflags = exec_llvm_config(&["--cxxflags"]);
|
||||
let mut cxxflags: Vec<String> = cxxflags.split_whitespace().map(String::from).collect();
|
||||
|
||||
@ -226,32 +242,24 @@ pub const LIBAFL_CC_LLVM_VERSION: Option<usize> = None;
|
||||
}
|
||||
}
|
||||
|
||||
let llvm_bindir = exec_llvm_config(&["--bindir"]);
|
||||
let bindir_path = Path::new(&llvm_bindir);
|
||||
|
||||
write!(
|
||||
clang_constants_file,
|
||||
"// These constants are autogenerated by build.rs
|
||||
|
||||
/// The path to the `clang` executable
|
||||
pub const CLANG_PATH: &str = {:?};
|
||||
pub const CLANG_PATH: &str = {clang:?};
|
||||
/// The path to the `clang++` executable
|
||||
pub const CLANGXX_PATH: &str = {:?};
|
||||
pub const CLANGXX_PATH: &str = {clangcpp:?};
|
||||
|
||||
/// The size of the edges map
|
||||
pub const EDGES_MAP_SIZE: usize = {};
|
||||
pub const EDGES_MAP_SIZE: usize = {edges_map_size};
|
||||
|
||||
/// The size of the accounting maps
|
||||
pub const ACCOUNTING_MAP_SIZE: usize = {};
|
||||
pub const ACCOUNTING_MAP_SIZE: usize = {acc_map_size};
|
||||
|
||||
/// The llvm version used to build llvm passes
|
||||
pub const LIBAFL_CC_LLVM_VERSION: Option<usize> = {:?};
|
||||
pub const LIBAFL_CC_LLVM_VERSION: Option<usize> = {llvm_version:?};
|
||||
",
|
||||
bindir_path.join("clang"),
|
||||
bindir_path.join("clang++"),
|
||||
edges_map_size,
|
||||
acc_map_size,
|
||||
llvm_version,
|
||||
)
|
||||
.expect("Could not write file");
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user