diff --git a/local/patches/relibc/P3-ldso-rpath-support.patch b/local/patches/relibc/P3-ldso-rpath-support.patch new file mode 100644 index 000000000..b889c0524 --- /dev/null +++ b/local/patches/relibc/P3-ldso-rpath-support.patch @@ -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), diff --git a/recipes/core/relibc/recipe.toml b/recipes/core/relibc/recipe.toml index e6844ac97..e5260422e 100644 --- a/recipes/core/relibc/recipe.toml +++ b/recipes/core/relibc/recipe.toml @@ -58,6 +58,8 @@ patches = [ # to prevent recursive include chain (stdint.h → sys/types.h → pthread.h) # from seeing undefined size_t when gnulib wrappers are present "P3-stddef-reorder.patch", + # ld.so: parse DT_RPATH in addition to DT_RUNPATH (RUNPATH takes precedence per gABI) + "P3-ldso-rpath-support.patch", ] [build]