Skip to content

Commit

Permalink
Fix loading of dylibs not in the search path in jit mode
Browse files Browse the repository at this point in the history
Reported in #1249
  • Loading branch information
bjorn3 committed Feb 28, 2023
1 parent 9e7c646 commit 162365e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/driver/jit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,11 @@ fn dep_symbol_lookup_fn(
.find(|(crate_type, _data)| *crate_type == rustc_session::config::CrateType::Executable)
.unwrap()
.1;
for &cnum in &crate_info.used_crates {
// `used_crates` is in reverse postorder in terms of dependencies. Reverse the order here to
// get a postorder which ensures that all dependencies of a dylib are loaded before the dylib
// itself. This helps the dynamic linker to find dylibs not in the regular dynamic library
// search path.
for &cnum in crate_info.used_crates.iter().rev() {
let src = &crate_info.used_crate_source[&cnum];
match data[cnum.as_usize() - 1] {
Linkage::NotLinked | Linkage::IncludedFromDylib => {}
Expand Down

0 comments on commit 162365e

Please sign in to comment.