Preserve mixed dylib load order
Authored by
mfwolffe <wolffemf@dukes.jmu.edu>
- SHA
fdcd358c8e951506fc0456874a5928ad54e17a75- Parents
-
de7cc73 - Tree
b67ff8e
fdcd358
fdcd358c8e951506fc0456874a5928ad54e17a75de7cc73
b67ff8e| Status | File | + | - |
|---|---|---|---|
| M |
src/lib.rs
|
9 | 1 |
| M |
tests/parity_corpus/strip_locals_exec/args.txt
|
7 | 0 |
| M |
tests/parity_corpus/symtab_partition_exec/args.txt
|
7 | 0 |
src/lib.rsmodified@@ -426,7 +426,14 @@ impl Linker { | |||
| 426 | ); | 426 | ); |
| 427 | } | 427 | } |
| 428 | 428 | ||
| 429 | - let mut load_paths = opts.inputs.clone(); | 429 | + let mut load_paths = Vec::new(); |
| 430 | + let mut positional_dylibs = Vec::new(); | ||
| 431 | + for path in &opts.inputs { | ||
| 432 | + match path.extension().and_then(|ext| ext.to_str()) { | ||
| 433 | + Some("dylib" | "tbd") => positional_dylibs.push(path.clone()), | ||
| 434 | + _ => load_paths.push(path.clone()), | ||
| 435 | + } | ||
| 436 | + } | ||
| 430 | let mut dylib_load_kinds = std::collections::HashMap::new(); | 437 | let mut dylib_load_kinds = std::collections::HashMap::new(); |
| 431 | for name in &opts.library_names { | 438 | for name in &opts.library_names { |
| 432 | let path = resolve_library_input(opts, name)?; | 439 | let path = resolve_library_input(opts, name)?; |
@@ -445,6 +452,7 @@ impl Linker { | |||
| 445 | ); | 452 | ); |
| 446 | load_paths.push(path); | 453 | load_paths.push(path); |
| 447 | } | 454 | } |
| 455 | + load_paths.extend(positional_dylibs); | ||
| 448 | 456 | ||
| 449 | let mut inputs = Inputs::new(); | 457 | let mut inputs = Inputs::new(); |
| 450 | let phase_started = Instant::now(); | 458 | let phase_started = Instant::now(); |
tests/parity_corpus/strip_locals_exec/args.txtmodified@@ -1,5 +1,12 @@ | |||
| 1 | -arch | 1 | -arch |
| 2 | arm64 | 2 | arm64 |
| 3 | +-platform_version | ||
| 4 | +macos | ||
| 5 | +@SDK_VERSION@ | ||
| 6 | +@SDK_VERSION@ | ||
| 7 | +-syslibroot | ||
| 8 | +@SDK_PATH@ | ||
| 9 | +-lSystem | ||
| 3 | -x | 10 | -x |
| 4 | -no_fixup_chains | 11 | -no_fixup_chains |
| 5 | -e | 12 | -e |
tests/parity_corpus/symtab_partition_exec/args.txtmodified@@ -1,5 +1,12 @@ | |||
| 1 | -arch | 1 | -arch |
| 2 | arm64 | 2 | arm64 |
| 3 | +-platform_version | ||
| 4 | +macos | ||
| 5 | +@SDK_VERSION@ | ||
| 6 | +@SDK_VERSION@ | ||
| 7 | +-syslibroot | ||
| 8 | +@SDK_PATH@ | ||
| 9 | +-lSystem | ||
| 3 | -no_fixup_chains | 10 | -no_fixup_chains |
| 4 | -e | 11 | -e |
| 5 | _main | 12 | _main |