Skip to content

Commit 42059a3

Browse files
committed
Remove libgccjit_path function
1 parent 58f3f31 commit 42059a3

File tree

1 file changed

+5
-9
lines changed
  • compiler/rustc_codegen_gcc/src

1 file changed

+5
-9
lines changed

compiler/rustc_codegen_gcc/src/lib.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -182,17 +182,12 @@ pub struct GccCodegenBackend {
182182

183183
static LTO_SUPPORTED: AtomicBool = AtomicBool::new(false);
184184

185-
fn libgccjit_path(sysroot_path: &Path, target_triple: &str) -> PathBuf {
186-
make_target_lib_path(sysroot_path, target_triple).join("libgccjit.so")
187-
}
188-
189-
fn load_libgccjit_if_needed(sysroot_path: &Path, target_triple: &str) {
185+
fn load_libgccjit_if_needed(libgccjit_target_lib_file: &Path) {
190186
if gccjit::is_loaded() {
191187
// Do not load a libgccjit second time.
192188
return;
193189
}
194190

195-
let libgccjit_target_lib_file = libgccjit_path(sysroot_path, target_triple);
196191
let path = libgccjit_target_lib_file.to_str().expect("libgccjit path");
197192

198193
let string = CString::new(path).expect("string to libgccjit path");
@@ -216,9 +211,10 @@ impl CodegenBackend for GccCodegenBackend {
216211
// invalid.
217212
// This is the case for instance in Rust for Linux where they specify --sysroot=/dev/null.
218213
for path in sess.opts.sysroot.all_paths() {
219-
let libgccjit_target_lib_file = libgccjit_path(path, &sess.target.llvm_target);
220-
if let Ok(true) = fs::exists(libgccjit_target_lib_file) {
221-
load_libgccjit_if_needed(path, &sess.target.llvm_target);
214+
let libgccjit_target_lib_file =
215+
make_target_lib_path(path, &sess.target.llvm_target).join("libgccjit.so");
216+
if let Ok(true) = fs::exists(&libgccjit_target_lib_file) {
217+
load_libgccjit_if_needed(&libgccjit_target_lib_file);
222218
break;
223219
}
224220
}

0 commit comments

Comments
 (0)