[elbe-devel] [PATCH 10/14] elbepack: relocate-toolchain: modify rpath before interpreter

Thomas Weißschuh thomas.weissschuh at linutronix.de
Wed Feb 28 11:39:03 CET 2024


Some versions of patchelf have a bug[0] which corrupts binaries making
them unusable, work around it.

[0] https://github.com/NixOS/patchelf/issues/524

Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
 .../makofiles/toolchain-shar-extract.sh.mako     | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/elbepack/makofiles/toolchain-shar-extract.sh.mako b/elbepack/makofiles/toolchain-shar-extract.sh.mako
index 6c4d54c04b13..f89c32783c26 100644
--- a/elbepack/makofiles/toolchain-shar-extract.sh.mako
+++ b/elbepack/makofiles/toolchain-shar-extract.sh.mako
@@ -354,14 +354,6 @@ for link in $abs_symbolic_links; do
         ln -s \$target \$link
 done
 
-for exe in $native_executable_files; do
-        if [ \`readlink -f \$exe\` == \`readlink -f $dl_path\` ]; then
-            echo SKIP \$exe
-        else
-            \$PATCHELF --set-interpreter $dl_path \$exe
-        fi
-done
-
 for exe in $native_elf_files; do
         if [ \`readlink -f \$exe\` == \`readlink -f $dl_path\` ]; then
             echo SKIP \$exe
@@ -387,6 +379,14 @@ for exe in $target_elf_files; do
         fi
 done
 
+for exe in $native_executable_files; do
+        if [ \`readlink -f \$exe\` == \`readlink -f $dl_path\` ]; then
+            echo SKIP \$exe
+        else
+            \$PATCHELF --set-interpreter $dl_path \$exe
+        fi
+done
+
 for exe in $ascii_so_files; do
 	sed -i -e "s%\([ (]\)/\(usr\|lib\|lib64\)/%\1$native_sysroot/\2/%g" \$exe
 done
-- 
2.44.0



More information about the elbe-devel mailing list