Remove libgccjit_path function
This commit is contained in:
parent
58f3f313b3
commit
42059a3041
1 changed files with 5 additions and 9 deletions
|
|
@ -182,17 +182,12 @@ pub struct GccCodegenBackend {
|
|||
|
||||
static LTO_SUPPORTED: AtomicBool = AtomicBool::new(false);
|
||||
|
||||
fn libgccjit_path(sysroot_path: &Path, target_triple: &str) -> PathBuf {
|
||||
make_target_lib_path(sysroot_path, target_triple).join("libgccjit.so")
|
||||
}
|
||||
|
||||
fn load_libgccjit_if_needed(sysroot_path: &Path, target_triple: &str) {
|
||||
fn load_libgccjit_if_needed(libgccjit_target_lib_file: &Path) {
|
||||
if gccjit::is_loaded() {
|
||||
// Do not load a libgccjit second time.
|
||||
return;
|
||||
}
|
||||
|
||||
let libgccjit_target_lib_file = libgccjit_path(sysroot_path, target_triple);
|
||||
let path = libgccjit_target_lib_file.to_str().expect("libgccjit path");
|
||||
|
||||
let string = CString::new(path).expect("string to libgccjit path");
|
||||
|
|
@ -216,9 +211,10 @@ impl CodegenBackend for GccCodegenBackend {
|
|||
// invalid.
|
||||
// This is the case for instance in Rust for Linux where they specify --sysroot=/dev/null.
|
||||
for path in sess.opts.sysroot.all_paths() {
|
||||
let libgccjit_target_lib_file = libgccjit_path(path, &sess.target.llvm_target);
|
||||
if let Ok(true) = fs::exists(libgccjit_target_lib_file) {
|
||||
load_libgccjit_if_needed(path, &sess.target.llvm_target);
|
||||
let libgccjit_target_lib_file =
|
||||
make_target_lib_path(path, &sess.target.llvm_target).join("libgccjit.so");
|
||||
if let Ok(true) = fs::exists(&libgccjit_target_lib_file) {
|
||||
load_libgccjit_if_needed(&libgccjit_target_lib_file);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue