fix: wire relibc ldso rpath support patch

This commit is contained in:
2026-05-07 07:50:45 +01:00
parent 853073f216
commit 8664e7ade1
2 changed files with 22 additions and 0 deletions
@@ -0,0 +1,20 @@
diff --git a/src/ld_so/dso.rs b/src/ld_so/dso.rs
index afb4c7c1..1aab77c7 100644
--- a/src/ld_so/dso.rs
+++ b/src/ld_so/dso.rs
@@ -722,7 +722,14 @@ impl DSO {
elf::DT_NEEDED => needed.push(entry),
elf::DT_JMPREL => jmprel = Some(ptr as usize),
- elf::DT_RUNPATH => runpath = Some(entry), // FIXME(andypython): rpath
+ elf::DT_RUNPATH => runpath = Some(entry),
+ elf::DT_RPATH => {
+ // DT_RPATH is the older form; DT_RUNPATH takes precedence.
+ // Only use RPATH if RUNPATH was not already set.
+ if runpath.is_none() {
+ runpath = Some(entry);
+ }
+ }
elf::DT_STRTAB => strtab_offset = Some(relative_idx),
elf::DT_STRSZ => strtab_size = Some(val),
elf::DT_SONAME => soname = Some(entry),