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),