Skip to content

Commit 561c070

Browse files
authored
fix: make relink on linux recognize ${ORIGIN} (#1647)
1 parent 56b94e1 commit 561c070

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/linux/link.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,10 @@ impl Relinker for SharedObject {
118118
.strip_prefix(prefix)
119119
.expect("library not in prefix"),
120120
);
121-
if let Ok(rpath_without_loader) = rpath.strip_prefix("$ORIGIN") {
121+
if let Ok(rpath_without_loader) = rpath
122+
.strip_prefix("$ORIGIN")
123+
.or_else(|_| rpath.strip_prefix("${ORIGIN}"))
124+
{
122125
if let Some(library_parent) = self_path.parent() {
123126
return to_lexical_absolute(rpath_without_loader, library_parent);
124127
} else {
@@ -169,7 +172,7 @@ impl Relinker for SharedObject {
169172
let mut final_rpaths = Vec::new();
170173

171174
for rpath in rpaths.iter().chain(runpaths.iter()) {
172-
if rpath.starts_with("$ORIGIN") {
175+
if rpath.starts_with("$ORIGIN") || rpath.starts_with("${ORIGIN}") {
173176
let resolved = self.resolve_rpath(rpath, prefix, encoded_prefix);
174177
if resolved.starts_with(encoded_prefix) {
175178
final_rpaths.push(rpath.clone());

0 commit comments

Comments
 (0)