File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -311,7 +311,11 @@ fn dep_symbol_lookup_fn(
311
311
. find ( |( crate_type, _data) | * crate_type == rustc_session:: config:: CrateType :: Executable )
312
312
. unwrap ( )
313
313
. 1 ;
314
- for & cnum in & crate_info. used_crates {
314
+ // `used_crates` is in reverse postorder in terms of dependencies. Reverse the order here to
315
+ // get a postorder which ensures that all dependencies of a dylib are loaded before the dylib
316
+ // itself. This helps the dynamic linker to find dylibs not in the regular dynamic library
317
+ // search path.
318
+ for & cnum in crate_info. used_crates . iter ( ) . rev ( ) {
315
319
let src = & crate_info. used_crate_source [ & cnum] ;
316
320
match data[ cnum. as_usize ( ) - 1 ] {
317
321
Linkage :: NotLinked | Linkage :: IncludedFromDylib => { }
You can’t perform that action at this time.
0 commit comments