From 4489516864b22f47d12d30bb298bba1d8824f2c3 Mon Sep 17 00:00:00 2001 From: nichmor Date: Fri, 16 Jan 2026 10:37:07 +0200 Subject: [PATCH] Add get_rpath() method to ElfContainer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a method to retrieve RPATH/RUNPATH entries as a list of paths, enabling maturin to use arwen instead of goblin for reading rpath values. Related: https://github.com/PyO3/maturin/pull/2932 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- src/elf/container.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/elf/container.rs b/src/elf/container.rs index ede9d64..f889dd8 100644 --- a/src/elf/container.rs +++ b/src/elf/container.rs @@ -56,6 +56,20 @@ impl<'a> ElfContainer<'a> { } } + /// Get the RPATH/RUNPATH entries as a list of paths. + /// Returns entries from DT_RUNPATH if present, otherwise DT_RPATH. + pub fn get_rpath(&self) -> Vec { + if let Some(runpath) = self.inner.elf_runpath() { + let path_str = String::from_utf8_lossy(runpath); + if path_str.is_empty() { + return Vec::new(); + } + path_str.split(':').map(|s| s.to_string()).collect() + } else { + Vec::new() + } + } + /// Force the ELF file to use the DT_RPATH instead of DT_RUNPATH. pub fn force_rpath(&mut self) -> Result<(), ElfError> { self.inner.elf_use_rpath()?;