Preserve ELF loader search order when collecting package runtime dependencies
Problem
The package resolver searches SDK/host directories before the executable RPATH/RUNPATH. It can replace the actual dependency with an unrelated same-name version and change program behavior.
Reproduction and evidence
Audited canonical master 69a67c6e0fb700f37ee6114f5a66d37ee13771a5 (0.0.1-alpha-dev). Matching checkout-built compiler/std were used for compiler probes on Linux amd64 with Rust 1.89.0 and LLVM 21.1.8. Artifact inspection, mocked/projection checks and foreign-target object emission are identified below and are not native execution on those operating systems.
Executed a native ELF fixture: compile two libauditdep.so providers (value() returns 11 in sdk/lib, 22 in actual/), and a program linked with RUNPATH to actual/. The original exits 22. Invoke runtime_closure(stage, "x86_64-unknown-linux-gnu", sdk, [(source_program, staged_program)]), then run with LD_LIBRARY_PATH=stage/llvm/lib. Observed: the SDK provider is copied and the staged program exits 11. Both libraries have the same SONAME and architecture.
Scope
Resolve dependencies with the relevant ELF loader search precedence, preserving ordered RPATH/RUNPATH entries and ORIGIN expansion. Keep conflict/type checks.
Starting points: tools/src/package.rs:361.
Completion criteria
- [ ] The fixture packages the provider selected by the original program contract.
- [ ] Test multiple path entries in order and distinguish RPATH from RUNPATH where applicable.
- [ ] Retain cross-target rejection and unresolved-library errors.
Related: #1070. Related broad trackers or completed implementations are context, not claims that their entire scope is unfinished.