[elbe-devel] [PATCH v2] build_sdk toolchain-shar-extract.sk.mako: only try to reloc ELF executables

Torben Hohn torben.hohn at linutronix.de
Wed Apr 24 15:14:25 CEST 2019


scripts are marked executable, but are not suposed to be relocated using
patchelf. Trying to get patchelf to relocate a script yields an error,
and stops the rlocation process.

Use file to check whether the executables are actually elf files.

Signed-off-by: Torben Hohn <torben.hohn at linutronix.de>
---
 elbepack/makofiles/toolchain-shar-extract.sh.mako | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/elbepack/makofiles/toolchain-shar-extract.sh.mako b/elbepack/makofiles/toolchain-shar-extract.sh.mako
index 96810aad..40e2dc86 100644
--- a/elbepack/makofiles/toolchain-shar-extract.sh.mako
+++ b/elbepack/makofiles/toolchain-shar-extract.sh.mako
@@ -280,7 +280,10 @@ if [ "$dl_path" = "" ] ; then
         exit 1
 fi
 executable_files=$($SUDO_EXEC find $native_sysroot -type f \
-        \( -perm -0100 -o -perm -0010 -o -perm -0001 \) -printf "'%h/%f' ")
+	\( -perm -0100 -o -perm -0010 -o -perm -0001 \) \
+	-exec sh -c "file {} | grep -Pi ': elf (32|64)-bit' > /dev/null" \; \
+	-printf "'%h/%f' ")
+
 if [ "x$executable_files" = "x" ]; then
    echo "SDK relocate failed, could not get executalbe files"
    exit 1
-- 
2.11.0




More information about the elbe-devel mailing list